Skip to content
Prev 366944 / 398506 Next

How to create 10 minute time series from hourly data

On Wed, Feb 1, 2017 at 10:41 AM, Mary Ann Middleton <maberg at sfu.ca> wrote:
Here's an xts solution:

# Create xts object from data.frame
x <- xts(Data[,c("ms", "LEVEL", "TEMPERATURE", "Level_m")], Data$date.time)
# Create regular, 10-minute, "zero-width" (i.e. no columns) xts object
# that spans all the times in 'x'
x10min <- xts(, order.by = seq(start(x), end(x), by = "10 min"))
# Merge regular xts object with original data, filling via zoo::na.approx
y <- merge(x, x10min, fill = na.approx)