R: How to use approx in more than one dimension (multidimensional interpolation)? -


this should no hard, searched lot , did not find solution far...

i dealing scattered data where

y = f(x1,x2,x3,..., xn) 

i create lookup function, gives me exact known values of y when entering vector x in data set, linearly interpolates when vector x not in data set.

basically approx(), higher number of dimensions.

to ease tryouts, here data:

y<-rnorm(27) x1<-seq(1,3,1) x2<-seq(10,30,10) x3<-seq(100,300,100)  df<-expand.grid(x1,x2,x3) df<-cbind(y,df) names(df)<-c("y","x1","x2","x3")  # task create function #   fun(x1,x2,x3) --> interpolated y  # expected output example: # fun(1,10,100) --> -0.89691454 # fun(1.5,10,100) --> -0.3560327 


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -