If you read the error message carefully and look at the data you included with dput() (for which I thank you!), you'll see that bandNum is a list, not a vector, just as the error message told you.
I'm not sure how you created or imported your data frame, but something appears to have not worked the way you expected. agPriceList=aggregate(PriceList$Size, list(unlist(PriceList$bandNum)),sum) will work, but you should probably look into correcting your data frame. Sarah On Wed, Oct 17, 2012 at 4:45 PM, jcrosbie <ja...@crosb.ie> wrote: > The aggregate function for some reason will now work for me. > > The error I'm getting is: > "Error in sort.list(y) : 'x' must be atomic for 'sort.list' > Have you called 'sort' on a list?" > > > > agPriceList=aggregate(PriceList$Size, list(PriceList$bandNum),sum) > > *Price list dataframe:* > dput(PriceList) > structure(list(Price = c(0, 8.18, 8.27, 10.42, 10.5, 10.6, 11.13, > 11.18, 11.21, 11.35, 11.36, 11.67, 11.89, 11.97, 12.05, 12.11, > 12.14, 12.53, 12.63, 12.7, 12.82, 12.96, 13, 13.08, 13.12, 13.14, > 13.15, 13.2, 13.43, 13.78, 13.95, 14.04, 14.06, 14.17, 14.21, > 14.3, 14.38, 14.44, 14.85, 14.9, 14.95, 14.96, 14.99, 15.03, > 15.07, 15.19, 15.3, 15.62, 15.77, 15.79, 16.05, 16.18, 16.22, > 16.24, 16.81, 16.85, 16.89, 17.03, 17.04, 17.05, 17.07, 17.11, > 17.15, 17.21, 17.3, 17.37, 17.59, 17.85, 18, 18.05, 18.09, 18.2, > 18.25, 18.45, 18.79, 18.83, 18.9, 18.94, 18.95, 18.99, 19.05, > 19.08, 19.12, 19.15, 19.17, 19.27, 19.45, 19.8, 19.85, 20.11, > 20.22, 20.36, 20.59, 20.64, 20.74, 20.82, 20.96, 21.05, 21.12, > 21.18, 21.33, 21.35, 21.5, 21.77, 22.04, 22.3, 22.34, 22.42, > 22.55, 22.94, 23, 23.04, 23.14, 23.2, 23.29, 23.36, 23.42, 23.43, > 23.44, 23.45, 23.54, 23.55, 23.61, 23.77, 23.83, 23.9, 23.96, > 24, 24.01, 24.14, 24.5, 24.61, 24.76, 24.85, 24.99, 25, 25.6, > 25.61, 25.7, 26.09, 26.5, 26.72, 26.89, 29.5, 30.54, 40.63, 40.73, > 41.74, 43.5, 44.33, 45.33, 46.05, 47.11, 47.34, 49.58, 50.71, > 77, 86.68, 97, 133.6, 203.48), Size = c(664640L, 440L, 407L, > 180L, 690L, 851L, 190L, 480L, 720L, 74L, 111L, 1560L, 11400L, > 160L, 9333L, 55665L, 222L, 23662L, 210L, 12735L, 1757L, 63736L, > 18318L, 460L, 120L, 680L, 400L, 960L, 432L, 259L, 840L, 8200L, > 630L, 180L, 189L, 1490L, 27L, 8080L, 6291L, 240L, 841L, 5469L, > 4035L, 12555L, 5320L, 9249L, 240L, 1149L, 40L, 660L, 333L, 4360L, > 180L, 360L, 240L, 2900L, 120L, 2639L, 1221L, 10019L, 2990L, 259L, > 25L, 320L, 1684L, 305L, 40L, 27L, 4213L, 108L, 222L, 216L, 80L, > 148L, 135L, 970L, 222L, 240L, 1332L, 43875L, 210L, 162L, 185L, > 180L, 459L, 35854L, 3270L, 162L, 259L, 120L, 9130L, 2120L, 111L, > 222L, 595L, 888L, 222L, 189L, 210L, 1740L, 630L, 520L, 120L, > 9673L, 160L, 648L, 280L, 378L, 240L, 40L, 444L, 407L, 210L, 185L, > 180L, 148L, 110L, 486L, 148L, 756L, 100L, 2750L, 40L, 720L, 1440L, > 185L, 259L, 240L, 259L, 150L, 37L, 481L, 222L, 90L, 111L, 5598L, > 222L, 222L, 222L, 222L, 322L, 112L, 222L, 690L, 180L, 222L, 12L, > 18L, 22L, 12L, 22L, 6L, 30L, 62L, 20L, 30L, 12L, 185L, 10L, 185L, > 10L), bandNum = list(0L, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, > 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, > 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, > 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, > 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, > 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, > 5, 5, 5, 5, 5, 5, 5, 5, 5L, 6, 6, 6, 6, 6, 6, 6, 6, 7, 9, > 9, 9, 9, 9, 10, 10, 10, 10, 10, 11, 16, 18, 20, 21, 22)), .Names = > c("Price", > "Size", "bandNum"), row.names = c(NA, -161L), class = "data.frame") > > -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ R-help@r-project.org 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.