On 4 Oct 2004 at 10:06, Peter Hyde wrote:

> Hi!  I have never used this before, so please forgive my lack of
> proper protocol...
> 
> 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
> record
> 
> 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

Hi

Chapter 2.7 of introduction manual says:

Subsets of the elements of a vector may be selected by 
appending to the name of the vector
an index vector in square brackets. More generally any 
expression that evaluates to a vector
may have subsets of its elements similarly selected by 
appending an index vector in square
brackets immediately after the expression.

And it gives further examples

Maybe this is what you want?

your.df[your.id.vector==your.id.no,]

shall select rows which have identical id.no and id.vector.
I hope I understood your question as you actually did not 
explained what you tried and how it failed.

Cheers
Petr




> 
> 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!!
> 
> thanks!
> 
> ______________________________________________
> [EMAIL PROTECTED] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
> http://www.R-project.org/posting-guide.html

Petr Pikal
[EMAIL PROTECTED]

______________________________________________
[EMAIL PROTECTED] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to