[R] interpSpline with dates?
Remko Duursma
remkoduursma at gmail.com
Thu Feb 26 03:30:25 CET 2009
Dear R-helpers,
can I use a POSIXct date as the x variable in interpSpline? The help
page says x and y need to be numeric... is there a workaround?
example:
library(splines)
testdfr <- data.frame(Date=seq(as.POSIXct("2008-08-01"),as.POSIXct("2008-09-01"),
length=10))
testdfr$yvar <- rnorm(10)
sp <- interpSpline(yvar ~ Date, testdfr)
preddfr <- data.frame(Date=as.POSIXct("2008-08-02"))
predict(sp, preddfr)
thanks,
Remko
-------------------------------------------------
Remko Duursma
Post-Doctoral Fellow
Centre for Plant and Food Science
University of Western Sydney
Hawkesbury Campus
Richmond NSW 2753
Dept of Biological Science
Macquarie University
North Ryde NSW 2109
Australia
Mobile: +61 (0)422 096908
More information about the R-help
mailing list