[R] Warning message with aggregate function

2007-09-06 Thread Xingwang Ye
Dear all, When I use aggregate function as: attach(warpbreaks) aggregate(warpbreaks[, 1], list(wool = wool, tension = tension), sum) The results are right but I get a warning message: number of items to replace is not a multiple of replacement length. BTW: I use R version 2.4.1 in Ubuntu 7.04.

Re: [R] Warning message with aggregate function

2007-09-06 Thread Uwe Ligges
Xingwang Ye wrote: Dear all, When I use aggregate function as: attach(warpbreaks) aggregate(warpbreaks[, 1], list(wool = wool, tension = tension), sum) The results are right but I get a warning message: number of items to replace is not a multiple of replacement length. BTW: I use R

Re: [R] Warning message with aggregate function

2007-09-06 Thread Xingwang Ye
Thank you for sharing your experience. The example data I used is from help for by function, so every one could have a try. After using $, the warning message disappeared: aggregate(warbreaks[,1], list(wool = warbreaks$wool, tension=warbreaks$tension),sum) Another approach may be to restart

Re: [R] Warning message with aggregate function

2007-09-06 Thread Bartjoosen
If I use your code, I don't get the error. Maybe you stripped your code to create a minimal, self-contained, reproducible code? Perhaps in your original code, you store the result of the aggragate function in a dataframe of a different size than the results? Bart felix-36 wrote: Dear