Skip to content
Prev 76190 / 398503 Next

A. Mani : Tapply

Hi
******************************
On 25 Aug 2005 at 20:28, A Mani wrote:

            
or gave you an error message? 

I tried this
replace=T)),B=as.factor(sample(100000:110000,100000,  
replace=T)), num=rnorm(100000))
and got 

Error: cannot allocate vector of size 390664 Kb 
In addition: Warning messages: 
1: Reached total allocation of 1000Mb: see help(memory.size)  
2: Reached total allocation of 1000Mb: see help(memory.size)
and the result with smaller data sets are 

df1<-data.frame(A=as.factor(sample(1:2,100000, 
replace=T)),B=as.factor(sample(10:11,100000, replace=T)), 
num=rnorm(100000)) 
ttt1<-tapply(df1$num, list(df1$A,df1$B), diff)
10            11            
1 Numeric,24933 Numeric,25141 
2 Numeric,24992 Numeric,24930 


df<-data.frame(A=as.factor(sample(1:1000,100000, 
replace=T)),B=as.factor(sample(10000:11000,100000, 
replace=T)), num=rnorm(100000)) 
 ttt<-tapply(df$num, list(df$A,df$B), diff)
10000 10001 10002 10003     10004 
1 NULL  NULL  NULL  Numeric,0 NULL  
2 NULL  NULL  NULL  Numeric,0 NULL
so you are probably receiving humonguous table of NULLs, zeros  
and few nonzero entries. 

You probably need to use different approach 

Cheers 
Petr 


The code used was on a 3-col
was diff
data$B),
Petr Pikal
petr.pikal at precheza.cz