Re: [R] subset of data frame

2014-02-09 Thread arun
Hi, Try: x[x$Species%in%names(sp)[1:2],] A.K. On Saturday, February 8, 2014 10:21 PM, Yuanzhi Li wrote: Hi, everyone I met a small problem when I want take a subset from a data frame. The data frame(x) looks like the followings(10 species with 3 measured traits): Species    trait1    tra

Re: [R] subset of data frame

2014-02-09 Thread Rui Barradas
Hello, First of all use ?dput to post a data example. dput(head(x, 20)) # paste the output of this in a post Now, without a reproducible example it's difficult to say but maybe ?%in% x[x$Species %in% names(sp)[1:2],] Hope this helps, Rui Barradas Em 09-02-2014 00:03, Yuanzhi Li escreveu:

[R] subset of data frame

2014-02-08 Thread Yuanzhi Li
Hi, everyone I met a small problem when I want take a subset from a data frame. The data frame(x) looks like the followings(10 species with 3 measured traits): Species trait1trait2 trait3 sp1 sp1 ... sp2 sp2 ... sp10 sp10 ... It would be easy if we want trait values for most abu

[R] subset of data frame

2014-02-08 Thread Yuanzhi Li
Hi, everyone I met a small problem when I want take a subset from a data frame. The data frame(x) looks like the followings(10 species with 3 measured traits): Species trait1trait2 trait3 sp1 sp1 ... sp2 sp2 ... sp10 sp10 ... It would be easy if we want trait values for most abu

Re: [R] Subset of Data Frame using the date

2011-02-01 Thread Henrique Dallazuanna
Try this: DF <- data.frame( "Date" = c("2009-09-01","2009-09-02","2009-09-03","2009-09-04", "2009-09-05"), "Data" = c( 10:14 ) ) subset(DF, as.Date(Date) >= '2009-09-02' & as.Date(Date) <= '2009-09-04') On Tue, Feb 1, 2011 at 11:09 AM, Usuario R wrote: > Hello, > > I have a data frame with one

[R] Subset of Data Frame using the date

2011-02-01 Thread Usuario R
Hello, I have a data frame with one column set as the date with function as.Date. In example: data.frame( "Date" = c("2009-09-01","2009-09-02","2009-09-03","2009-09-04", "2009-09-05"), "Data" = c( 10:14 ) ) Date Data 2009-09-01 10 2009-09-02 11 2009-09-03 12 2009-09-04 13 Is there