[R] Subset POSIXlt Field

Ryan Garner ryan.steven.garner at gmail.com
Tue Oct 5 23:15:04 CEST 2010


This should work:
> test <-subset(wild,ID=="2830" & Date==as.POSIXlt("2010-08-17"))

If not, here's another solution:
> dates <- c("2010-05-28","2010-08-17")
> dates <- as.POSIXlt(dates)
> id <- c("2830","2830")
> data <- data.frame(id,dates)
> test <- data[data$id == "2830" & data$dates == as.POSIXlt("2010-08-17"), ]
> test
    id      dates
2 2830 2010-08-17
-- 
View this message in context: http://r.789695.n4.nabble.com/Subset-POSIXlt-Field-tp2956822p2956890.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list