I think I have worked out the problem, and because it may trouble
others, I take the liberty of explaining it on the mailing list.
When diff is applied to a vector of POSIXt values returned by strptime,
the units depend upon the smallest interval in the input vector. If that
interval is less th
Prof Brian Ripley wrote:
> You are throwing away the clue in your use of as.numeric.
>
> First. strptime returns a POSIXlt value, which you will convert to
> POSIXct when you do arithetic (using diff()). Why are you doing that? So
>
>> foodate<-factor(c("1/7/1991","1/8/1991","1/8/1991","3/8/19
You are throwing away the clue in your use of as.numeric.
First. strptime returns a POSIXlt value, which you will convert to POSIXct
when you do arithetic (using diff()). Why are you doing that? So
> foodate<-factor(c("1/7/1991","1/8/1991","1/8/1991","3/8/1991"))
> diff(strptime(foodate,"%d/%m
Hi all,
I have been chipping away at a problem I encountered in calculating
rates per year from a moderately large data file (46412 rows). When I
ran the following command, I got obviously wrong output:
interval<-
c(NA,as.numeric(diff(
strptime(mkdf$MEAS_DATE,"%d/%m/%Y")))/365.25)
The valu
4 matches
Mail list logo