[R] Aggregate?

Gustaf Rydevik gustaf.rydevik at gmail.com
Fri Dec 8 10:58:01 CET 2006


Hi All,

I think i'm failing to undersatnd how aggregate() is supposed to work.

example:

 test1<-sample(c(0,1),100,replace=T)
test2<-sample(letters,100,replace=T)
aggregate(test1,list(test2),sum)
Error in data.frame(w, lapply(y, unlist, use.names = FALSE)) :
        arguments imply differing number of rows: 26, 0

I thought this would give me a list containing the number of ones that
"belong" to each letter. What am I doing wrong?

Thanks in advance,

Gustaf

-- 
email:gustaf.rydevik at gmail.com
tel: +46(0)703051451
address: Kantorsgatan 50:190 75424 Uppsala Sweden




More information about the R-help mailing list