Displaying 1 result from an estimated 1 matches for "colrow".
2005 Jul 04
1
A faster way to aggregate?
...ata set).
Any suggestions to speed this up? Yes, I could wait for the result in real
life, but just curious if I did something wrong. In real life, data set is
ordered by groups, but how can I use this with a data frame?
Dieter Menne
# Generate test data
ncol = 20
nrow = 20000
ngroup=nrow %/% 20
colrow=ncol*nrow
group = factor(floor(runif(nrow)*ngroup))
sc = data.frame(group,matrix(ifelse(runif(colrow) >
0.1,runif(colrow)>0.3,NA),
nrow=nrow))
# aggregate
system.time ({
s = aggregate(sc[2:(ncol+1)],list(group = group),
function(x) {
xt=table(x)
as.integer(100*xt[2]/(...