[R] Extract only certain rows from a table

naw3 at duke.edu naw3 at duke.edu
Wed Jun 18 15:36:45 CEST 2008


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



More information about the R-help mailing list