An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110523/bac6b7e1/attachment.pl>
days between dates
5 messages · Geoffrey Smith, William Armstrong, Jeff Newmiller +1 more
Geoff,
I think you could write an if loop to solve this.
You could write:
for(i in 1:num_obs){
if(DAYS[i]=='Monday'){
DF$DAYS.BETWEEN[i]<-1
}
}
Where 'num_obs' is the total number of temperature observations you have.
This would only be correct if you had no missing data on Fridays. Also, if
you had any missing Mondays, the Tuesday 'DAYS.BETWEEN' would be a 5 instead
of a 2.
Maybe there's a better way to do this, but I think this should work as long
as you have a pretty complete record.
Billy
--
View this message in context: http://r.789695.n4.nabble.com/days-between-dates-tp3544335p3544643.html
Sent from the R help mailing list archive at Nabble.com.
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110523/9c7b224f/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110523/5b2989f9/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110523/381e66fd/attachment.pl>