Re: [R] How to refer to rows using a vector of row names ?

From: Ng Stanley <stanleyngkl_at_gmail.com>
Date: Fri, 11 Apr 2008 20:08:50 +0800

That should work well too if my row names are integers only. However, they are strings of alphanumeric characters

On Fri, Apr 11, 2008 at 7:56 PM, Philipp Pagel <p.pagel_at_wzw.tum.de> wrote:

> On Fri, Apr 11, 2008 at 07:00:10PM +0800, Ng Stanley wrote:
> > I tried that, it will work well if the vector contain unique row names.
> > However, my vector contain duplicate row names.
>
> how about
>
> # generate toy data frame
> d = data.frame(x=1:10, y=10:1)
> # set up a vector of row names
> v = c('1','3','1','4','3')
> # select
> newd = d[v,]
>
> cu
> Philipp
>
> --
> Dr. Philipp Pagel Tel. +49-8161-71 2131
> Lehrstuhl für Genomorientierte Bioinformatik Fax. +49-8161-71 2186
> Technische Universität München
> Wissenschaftszentrum Weihenstephan
> 85350 Freising, Germany
>
> and
>
> Institut für Bioinformatik und Systembiologie / MIPS
> Helmholtz Zentrum München -
> Deutsches Forschungszentrum für Gesundheit und Umwelt
> Ingolstädter Landstrasse 1
> 85764 Neuherberg, Germany
> http://mips.gsf.de/staff/pagel
>
> ______________________________________________
> 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<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

        [[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 Fri 11 Apr 2008 - 12:12:12 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 Fri 11 Apr 2008 - 13:30:28 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