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.POS
Jared -
The value "2010-08-17" is a character value, and your dates
are stored as POSIXlt values. So you'd need to use
Date == as.POSIXlt("2010-08-17")
in your subset statement.
- Phil Spector
Statistic
Hello All
I, for the life of me, can't figure out to subset my dataframe by my Date
field. The field has been formatted as POSIXlt.
str(wild)
..
$ Date: POSIXlt, format: "2010-05-28" "2010-05-28" "2010-05-28" ...
This doesn't work:
test <-subset(wild,ID=="2830" & Date=="2010-08-17"
3 matches
Mail list logo