Re: [R] summaryBy(): Is it the best option?

2006-12-06 Thread Petr Pikal
Hi

I did not see any answer yet so I try. You can use aggregate, by or 
sapply.

Something like
aggregate(soc6a[, your columns], list(hh=hh), sum, na.rm=T)
by(soc6a[, your columns], hh, sum, na.rm=T)
sapply(split(soc6a[, your columns], hh), sum, na.rm=T)

But you have to check speed gain by yourself.

HTH
Petr



On 5 Dec 2006 at 1:30, Werner Wernersen wrote:

Date sent:  Tue, 5 Dec 2006 01:30:50 +0100 (CET)
From:   Werner Wernersen [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject:[R] summaryBy(): Is it the best option?

 Hi,
 
 since I have quite large tables and the processing
 takes quite a while I am
 curious if I can improve the performance of this
 aggregation somehow: At the 
 moment I am using summaryBy from the doBy package
 under R 2.4.0, Win2K.
 
 summaryBy(soc_s6aq5 + soc_s6aq7 + soc_s6aq9 +
 soc_s6aq11 ~ hh + 
 comgroup,soc6a,postfix=c(,,,),FUN=sum,
 na.rm=T)
 
 The data.frame has 124100 rows and 13 cols.
 
 Thanks for any hints!
 
 Werner
 
 __
 R-help@stat.math.ethz.ch 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.

Petr Pikal
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch 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.


[R] summaryBy(): Is it the best option?

2006-12-04 Thread Werner Wernersen
Hi,

since I have quite large tables and the processing
takes quite a while I am
curious if I can improve the performance of this
aggregation somehow: At the 
moment I am using summaryBy from the doBy package
under R 2.4.0, Win2K.

summaryBy(soc_s6aq5 + soc_s6aq7 + soc_s6aq9 +
soc_s6aq11 ~ hh + 
comgroup,soc6a,postfix=c(,,,),FUN=sum,
na.rm=T)

The data.frame has 124100 rows and 13 cols.

Thanks for any hints!

Werner

__
R-help@stat.math.ethz.ch 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.