Hi
My dataframe looks like this
data=
id V1 V2 V3 V4
1 5 6 7 8
1 10 20 30 40
2 23 54 54 6
3 43 54 54 33
4 12 34 54 54
4 34 54 23 52
I have to sum by id
I used command aggregate(data,by =list(data$id),FUN=sum)
Error i face is
Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L), na.rm = FALSE) :
sum not meaningful for factors
Please help me
-----
Thanks in Advance
Arun
--
View this message in context: http://r.789695.n4.nabble.com/Error-in-Aggregate-tp4431318p4431318.html
Sent from the R help mailing list archive at Nabble.com.
Error in Aggregate
2 messages · arunkumar1111, R. Michael Weylandt
The error message is clear: your problem is that your data.frame (note the period) contains factors. Use str(data) -- also don't use data as it's a function name -- to see which ones and change as appropriate. Michael
On Wed, Feb 29, 2012 at 7:16 AM, arunkumar1111 <akpbond007 at gmail.com> wrote:
Hi My dataframe ?looks like this data= id V1 V2 V3 V4 1 ?5 6 ?7 8 1 ?10 20 30 40 2 ?23 54 54 6 3 ?43 54 54 33 4 ?12 34 54 54 4 ?34 54 23 52 I have to sum by id I used command aggregate(data,by =list(data$id),FUN=sum) Error i face is Error in Summary.factor(c(1L, 1L, 1L, 1L, 1L), na.rm = FALSE) : ?sum not meaningful for factors Please help me ----- Thanks in Advance ? ? ? ?Arun -- View this message in context: http://r.789695.n4.nabble.com/Error-in-Aggregate-tp4431318p4431318.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at 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.