Re: [R] rollapply and difftime

2016-05-26 Thread Nordlund, Dan (DSHS/RDA)
Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Morway, > Eric > Sent: Thursday, May 26, 2016 5:00 PM > To: R mailing list > Subject: [R] rollapply and difftime > > Technically, the code below works and results in a column that I&#

Re: [R] rollapply and difftime

2016-05-26 Thread Jeff Newmiller
What about just diff( dts ) or as.numeric( diff( dts ), units="days" ) ? -- Sent from my phone. Please excuse my brevity. On May 26, 2016 5:09:20 PM PDT, "MacQueen, Don" wrote: >You want the number of days between dates? >Does this do the trick? > >dts <- Sys.Date()+ c(1,2,3,5,6,9) >dts[-1]

Re: [R] rollapply and difftime

2016-05-26 Thread MacQueen, Don
You want the number of days between dates? Does this do the trick? dts <- Sys.Date()+ c(1,2,3,5,6,9) dts[-1] - dts[-length(dts)] Time differences in days [1] 1 1 2 1 3 -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 5/26/1

[R] rollapply and difftime

2016-05-26 Thread Morway, Eric
Technically, the code below works and results in a column that I'm interested in working with for further processing. However, it is both inefficient on lengthy (>100 yr) daily time series and is, frankly, not the R way of doing things. Using the 'Daily' data.frame provided below, I'm interested