Displaying 1 result from an estimated 1 matches for "interpsecteur".
Did you mean:
interpsecteurs
2010 Nov 10
2
force apply not to drop the dimensions of FUN results ?
...oblem:
I have an array with at least four dimensions:
> dim(myArray)
[1] 20 17 3 6
I'd like to apply a function to each occurrence of the matrix (3x6)
defined by the last two dimensions. This interpolation function always
return a matrix of the same dimensions as its argument:
> interpSecteurs.f(myArray[1, 1, , ])
secteur
rotation 1 2 3 4 5 6
1 3 5.25 10 6 6 3
2 3 10.00 10 7 7 3
3 3 0.50 10 8 8 3
But when applying this function with apply, these matrices are coerced
in vectors of length 18:
> test <- apply(myArray,
+ c(1, 2...