[R] Error in Aggregate

2012-02-29 Thread arunkumar1111
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@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.


Re: [R] Error in Aggregate

2012-02-29 Thread 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, arunkumar akpbond...@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@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.

__
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.


[R] Error in Aggregate function

2010-02-26 Thread Meenakshi

Hi,

When I run the Aggregate function in repeat loop, I got the following error:

Error in sort.list(unique.default(x), na.last = TRUE) : 
  'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?

How to solve this error. Anyone can help me. Urgent.

Thanks.
Meenakshi.
-- 
View this message in context: 
http://n4.nabble.com/Error-in-Aggregate-function-tp1570370p1570370.html
Sent from the R help mailing list archive at Nabble.com.

__
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.