金子邦彦研究室プログラミングR のプログラム例R システムでデータを補間する(R システム を使用)

R システムでデータを補間する(R システム を使用)

install.packages("zoo")
library(zoo)

X <- matrix(c(1, 101, 3, 103, 7, 107), ncol = 2, byrow = TRUE)
Y <- matrix(NA, ncol = 2, nrow = 30)
for (i in 1:3) {
  Y[i*10-9,] <- X[i,]
}
na.approx(Y)