Convert array 3 dimensions data into functional data in r

Viewed 17

i have an array with dimension [ 128, 64, 1140 ], and i want to convert this array into functional data object, this is the function :

for (i in 1:dim(sst2)[1]) {
  for (j in 1:dim(sst2)[2]) {
    tmpfdd <- Data2fd(argvals = 1140,
                    y = sst2[i, j,],
                    basisobj = create.fourier.basis(nbasis = 15))
  }
}

when i run this program, i get this error :

Error in argvalsySwap(argvals, y, basisobj) : 
dimensions of 'argvals' and 'y' must be compatible;
dim(argvals) = 1; dim(y) = 1140
0 Answers
Related