Re: [R] Summing daily values by weekday and weekend

2011-07-22 Thread Hu, Yinghua
Jeff, Thanks for the hint. It is a good solution. Thanks! From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us] Sent: Thursday, July 21, 2011 7:00 PM To: Hu, Yinghua; r-help@r-project.org Subject: Re: [R] Summing daily values by weekday and weekend Clue: make a column representing the desired

Re: [R] Summing daily values by weekday and weekend

2011-07-21 Thread Jeff Newmiller
Clue: make a column representing the desired classification, and then use any of the methods you considered to do the summarizing. One possible approach: myframe$wend <- as.factor(ifelse(weekday( myframe$dates) %in% c("Saturday","Sunday"), "Weekend", "Weekday"))

[R] Summing daily values by weekday and weekend

2011-07-21 Thread Hu, Yinghua
(Sorry for reposting. Please delete previous msgs. Thanks!) Hi, all Here I created a data frame like mydates<- seq(as.Date("2010-05-29"), length = 43, by = "day") myvalues<-runif(43,0,1) myframe<-data.frame(dates=mydates, day=weekdays(dates), value=myvalues) dates day valu