[R] subset on data frame

michael watson (IAH-C) michael.watson at bbsrc.ac.uk
Sat Nov 20 15:57:18 CET 2004


Try something like

mydataframe[rownames(mydataframe) %in% myrow,]

Mick

-----Original Message-----
From:	Lei Jiang [mailto:lj22 at u.washington.edu]
Sent:	Sat 11/20/2004 12:54 AM
To:	R-help at stat.math.ethz.ch
Cc:	
Subject:	[R] subset on data frame
I have a data frame. And I'd like to subset according to rownames.

subset(mydataframe, rownames(mydataframe) == myrow, select = mycols)

it turned out that "myrow" cannot be a vector. But I have multiple rows to 
pick. Is there a way to get around this problem??

Thank you for your help!!

Lei Jiang

Department of Chemsitry
University of Washington
Box 351700
Seattle, WA 98195
Phone: 206-616-6882
Fax: 206-685-8665

______________________________________________
R-help at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list