[R] subset

K. Elo maillists at nic.fi
Thu Mar 5 14:33:06 CET 2009

Hi Yannick,

yannick misteli wrote:
> I have a vector x with certain ID numbers in it and want to create a
> subset from my dataset Y with this vector i.e extract only the data with
> the given IDs from vector x.
> example:
> x
> [1] 10066924 10207314 10257322 10334594 10348247
> and now I want to create subset of dataset "assignee" with
> assignee$pdpass ==  x

Try this:

assignee.1<-subset(assignee, pdpass %in% x)

Kind regards,

More information about the R-help mailing list