Re: [R] Outer, kronecker, etc.

2008-11-12 Thread baptiste auguie
you may want to look into Hadley's new package plyr for this kind of operation. baptiste On 12 Nov 2008, at 17:51, Stavros Macrakis wrote: By-the-way^2: is there some Xapply function that maps a function over all the elements of a structure (vector, matrix, list, ...) and preserves the origi

Re: [R] Outer, kronecker, etc.

2008-11-12 Thread Prof Brian Ripley
See ?Vectorize. sqrt() works on a matrix, and so does A <- matrix(1:4^2,2,2) A[] <- sapply(A, sqrt) On Wed, 12 Nov 2008, Stavros Macrakis wrote: `outer` (and related functions like kronecker) require that their functional argument operate elementwise on arrays. This means for example that

[R] Outer, kronecker, etc.

2008-11-12 Thread Stavros Macrakis
`outer` (and related functions like kronecker) require that their functional argument operate elementwise on arrays. This means for example that outer( 1:2, 3:4, list) or outer(1:2,3:4,function(a,b){1}) gives an error. Is there a version of `outer`/`kronecker`/etc. that takes arbitr