Another new question: I want to be able to subset the data based on whether or not that data point was recorded on a holiday. The is.holiday() function from the chron package would be perfect for this. However, when I try it, the following happens (I'm also using the timeDate package):
> holidays<-ChristmasDay(2008:2011) > holidays<-as.POSIXct(holidays, format="%Y-%m-%d") > subset(OverallData, is.holiday(OverallData$Date)) [1] Date Score <0 rows> (or 0-length row.names) I'm not sure what I'm supposed to do to make this work "half.hours <- function(x){ s <- strsplit(as.character(x), ":") H <- as.integer(sapply(s, `[`, 1)) M <- as.integer(sapply(s, `[`, 2)) h <- (H*60 + M)/60 floor(h/0.5)*0.5 } half.hours(dat$SunTime) " When I did this, everything came out as NA. But I used the following code and it worked: halfhours<-function(x){ H<-hours(x) M<-minutes(x) ifelse(M<30, H, H+.5) } Thanks again for your help! -- View this message in context: http://r.789695.n4.nabble.com/Questions-about-doing-analysis-based-on-time-tp4634230p4636353.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@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.