On Feb 15, 2012, at 7:19 AM, R. Michael Weylandt wrote:

Sorry about that -- forgot the case where you might only have a
certain entry once: try this,

sapply(split(GS, rownames(GS)), function(x) colSums(as.matrix(x)))

or

sapply(split(GS, rownames(GS)), function(x) if(is.matrix(x)) colSums(x) else x)

I'm not sure if there's a way to force split to give you matrix
elements back but it would be nice.

The help(split) page says there is a 'drop' parameter. That would have been what I tried first.

--

David Winsemius, MD
West Hartford, CT

______________________________________________
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