Re: [R] filter data from data frame

From: John Kane <jrkrideau_at_yahoo.ca>
Date: Tue, 12 Feb 2008 17:22:23 -0500 (EST)


?merge

Let the data.frame be xx

yy <- data.frame(ORF=
c("YAL026C","YAL041W","YAL048C","YAL007C","YAL012W",

       "YAL016W" ))    merge(xx,yy, by="ORF")

should do it.
--- Roberto Olivares Hernandez <roh_at_bio.dtu.dk> wrote:

> Hi,
> I have a data frame Y with the following
> information,
>
> ORF spectra
> 1 YAL001C 2
> 2 YAL005C 21
> 3 YAL007C 2
> 4 YAL012W 8
> 5 YAL016W 24
> 6 YAL019W 3
> 7 YAL020C 2
> 8 YAL021C 7
> 9 YAL022C 3
> 10 YAL023C 6
> 11 YAL026C 2
> 12 YAL029C 1
> 13 YAL031C 1
> 14 YAL035W 48
> 15 YAL038W 173
> 16 YAL041W 4
> 17 YAL042W 4
> 18 YAL048C 1
> 19 YAL049C 1
> 20 YAL051W 1
>
>
> In the other hand I have this object X with
> character elements as following
>
> "YAL026C"
> "YAL041W"
> "YAL048C"
> "YAL007C"
> "YAL012W"
> "YAL016W"
>
> and I want to generate a new data frame exclusively
> with the elements from the object X and its
> respective spectra value from the data frame Y. how
> to do it?
>
> I have tried to look into several functions, match,
> subset, command Y[ X, ], and I still can not get it
>
>
> thanks in advance
>
> Roberto
>
>
>
>
>
>
>
>
>
>
> [[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.
>



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 Tue 12 Feb 2008 - 22:58:02 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 Tue 12 Feb 2008 - 23:30:13 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