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 original structure?  For example, I'd want
Xapply(matrix(1:4^2,2,2),sqrt) == sqrt(matrix(1:4^2,2,2)).  In this
case, I'd use Xapply(as.character,mm), because as.character returns a
vector.

_____________________________

Baptiste AuguiƩ

School of Physics
University of Exeter
Stocker Road,
Exeter, Devon,
EX4 4QL, UK

Phone: +44 1392 264187

http://newton.ex.ac.uk/research/emag

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to