bates at stat.wisc.edu
Mon Oct 4 16:35:01 CEST 2004
You are most of the way to the answer when you use the word "subset".
There is a subset function to do exactly this. You probably want
subframe <- subset(myDataFrame, id %in% myIdSample)
Peter Hyde wrote:
> Hi! I have never used this before, so please forgive my lack of proper
> Would someone please tell me how to subset a dataframe?
> I have a table of data with x & y (spatial) coordinates, 2 attributes
> (tree height and biomass) and a unique identification number for each
> i have also created an array of random numbers equal to the number of
> records in my data frame
> i am trying to subset, in order to get the records that correspond to my
> unique id numbers
> basically, i am trying to figure out the equivalent to the "where" command
> in IDL (which I understand is FORTRAN-like)
> any insight would be greatly appreciated!!
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
More information about the R-help