I want to do a simple linear interpolation for NA values of each row of a big matrix (52017455 x 150), generally I can do this by using the na.approx function in zoo package with apply function, however, this is too slow, I wonder whether there is a Rcpp or data.table function or packge to do this? Generally, my data is spatial-temporal grid of remotesensing, I have tried to using approxNA function in raster package, but it is not fast enough.
x=rnorm(120)
x[c(3,8,16,22)]=NA
data=data.frame(t(x))
data=data[rep(1,52017455),]
result=apply(data,1,zoo::na.approx)