Try:
subset(tb, ID %in% vec)
On Wed, Jun 18, 2008 at 10:36 AM, <naw3@duke.edu> wrote:
> Hi,
>
> I have a table where column 1 has ID numbers and column two has data, and I
> have
> a vector containing a subset of those ID numbers. How can I create a new
> table
> with only the rows from the old table that match the IDs in the vector,
> like
> below:
>
> Original Table:
>
> ID Value
> 1 123
> 2 123
> 3 123
> 4 123
>
> vect: [2, 3]
>
> New table:
>
> ID Value
> 2 123
> 3 123
>
>
> Thank you so much!
> -Nina
>
> ______________________________________________
> R-help@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.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
[[alternative HTML version deleted]]