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
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
`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
3 matches
Mail list logo