Re: [R] Extract only certain rows from a table

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Wed, 18 Jun 2008 10:44:45 -0300

Try:

 subset(tb, ID %in% vec)

On Wed, Jun 18, 2008 at 10:36 AM, <naw3_at_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_at_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]]


______________________________________________ R-help_at_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.

Received on Wed 18 Jun 2008 - 14:58:40 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 18 Jun 2008 - 16:30:47 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive