resample & interpolate

Published by onesixx on

How do I resample and interpolate timeseries data in R?

# irregular time points at which data was sampled
t <- c(5,10,15,  25,30,  40,  50)
# measurements 
y <- c(4.3, 1.2, 5.4, 7.6, 3.2, 1.2, 3.7)

f <- approxfun(t,y, method="linear")

# get interpolated values for time points 5, 20, 35, 50
f(seq(from=5,to=50,by=15))
[1] 4.3 6.5 2.2 3.7

Categories: ts

onesixx

Blog Owner

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x