[R] A simple problem

Bill.Venables at csiro.au Bill.Venables at csiro.au
Mon Mar 30 05:34:53 CEST 2009


In fact

subset(mydata, skill == 1)

is all that you need, unless skill is a factor, when

subset(mydata, skill == "1")

does the trick. 

More importantly, as a general rule, if you think you need to use '$' in connexion with subset(), transform(), with() or within(), you are most likelyu not really getting the point.   These functions have a minor purpose of obviating the need to use things like '$'.


Bill Venables
http://www.cmis.csiro.au/bill.venables/ 


-----Original Message-----
From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] On Behalf Of milton ruser
Sent: Monday, 30 March 2009 1:15 PM
To: minben
Cc: r-help at r-project.org
Subject: Re: [R] A simple problem

Suggestion of thread: "Selecting rows from dataframe"

subset(mydata, mydata$skill==1") may works.

Best wishes

milton




On Sun, Mar 29, 2009 at 10:27 PM, minben <minbenh at gmail.com> wrote:

> I am a new R user. Now I have some problem while I use R. I have set
> up a data frame called "mydata". One of the colume of it was "skill".
> Now I want to select the observations of the frame whose "skill" value
> is 1,by what command can I get it?
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]

______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list