[R] RES: time series interpolation

Joshua Ulrich josh.m.ulrich at gmail.com
Thu Jun 30 14:59:32 CEST 2011


On Thu, Jun 30, 2011 at 6:10 AM, tomtomme <langkamp at tomblog.de> wrote:
> Thanks for the hints. Eitherway I´ve found another solution now:
>
More correctly, I answered the question you cross-posted on StackOverflow:
http://stackoverflow.com/questions/6520799/interpolate-time-series-of-multiple-tables

> w03_11temp<-read.delim2("w03_11.ASC", fileEncoding="ISO-8859-15", skip = 4)
> colnames(w03_11temp) <- c("date", "time", "temp")
> library(zoo)
> w03_11temp_z <- zoo(w03_11temp$temp,
>  as.POSIXct(paste(w03_11temp$date, w03_11temp$time), format="%d.%m.%y
> %H:%M:%S"))
> w03_11temp_y <- merge(w03_11temp_z, zoo(order.by=seq(start(w03_11temp_z),
> end(w03_11temp_z), by=1)))
> w03_11temp_x <- na.approx(w03_11temp_y)
> w03_11temp_w <- data.frame(date=format(index(w03_11temp_x), "%d.%m.%y"),
>                   time=format(index(w03_11temp_x), "%H:%M:%S"),
> temp=coredata(w03_11temp_x))
>
>

--
Joshua Ulrich  |  FOSS Trading: www.fosstrading.com



More information about the R-help mailing list