On Feb 15, 2012, at 15:17 , R. Michael Weylandt wrote:

> But that's dropping unused factor levels, not the drop of `[`

Is there a good reason that nobody has suggested looking at aggregate()? There 
would seem to be a little red tape to sort out, but, I mean, this is generally 
speaking what aggregate() is intended for.

(And please choose an intelligent Subject: field next time. We now have two 
"question" threads mixed up, not to mention multiple other long-dead "question" 
threads from the last 1.5 years that get resurrected and inserted at the head 
of the thread.)  

-pd

> 
> Michael
> 
> On Wed, Feb 15, 2012 at 9:16 AM, David Winsemius <dwinsem...@comcast.net> 
> wrote:
>> 
>> 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.

-- 
Peter Dalgaard, Professor
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd....@cbs.dk  Priv: pda...@gmail.com

______________________________________________
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