[R] force apply not to drop the dimensions of FUN results ?

2010-11-10 Thread Yves REECHT
Dear R users, Here is my problem: 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

Re: [R] force apply not to drop the dimensions of FUN results ?

2010-11-10 Thread Claudia Beleites
Dear Yves, You may not need to do more than set the dim attribute correctly: dim (test) - c (dim (myArray) [c (3 : 4, 1 : 2)] or dim (test) - c (dim (myArray) [c (4 : 3, 1 : 2)] Claudia -- Claudia Beleites Dipartimento dei Materiali e delle Risorse Naturali Università degli Studi di Trieste

Re: [R] force apply not to drop the dimensions of FUN results ?

2010-11-10 Thread Yves . Reecht
Thank you very much Claudia, That (the first form) works perfectly. Easily made generic using head and tail on the dim attribute. All the best, Yves Claudia Beleites cbelei...@units.it a écrit : Dear Yves, You may not need to do more than set the dim attribute correctly: dim (test) - c