[R] dataframe subset

Adaikalavan Ramasamy ramasamy at cancer.org.uk
Wed Feb 8 16:06:37 CET 2006


Sounds like you may need no use match().

On Wed, 2006-02-08 at 15:21 +0100, Bernhard Baumgartner wrote:
> I have a dataframe with a column, say "x" consisting of values, each 
> value appearing different times, e.g.
> x: 1,1,1,1,2,2,4,4,4,9,10,10,10,10,10 ...
> and a vector, including e.g.:
> y: 2,9,10,...
> I need a subset of the dataframe: all rows where x is equal to one of 
> the values in y. Currently I use a loop for this, but because x and y 
> are large this is very slow. 
> Is there any idea how to solve this problem faster?
> Thank you,
> Bernhard
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>




More information about the R-help mailing list