[R] Aggregate issues with subset

John Kane jrkrideau at yahoo.ca
Thu Oct 2 15:18:41 CEST 2008


I don't have R on this machine to check but are you sure that sc_recov still exists in s.all?

Otherwise do str(s.all) and see what the object looks like.



--- On Wed, 10/1/08, Michael Just <mgjust at gmail.com> wrote:

> From: Michael Just <mgjust at gmail.com>
> Subject: [R] Aggregate issues with subset
> To: "r-help at r-project.org" <r-help at r-project.org>
> Received: Wednesday, October 1, 2008, 6:28 PM
> Hello,
> I used the aggregate function with success on my data frame
> "all".
> 
> > aggregate(all, list(sc_recov), mean)
> 
> I then made a subset of this data frame:
> 
> >s.all <-subset(all, select=
> c(3,4,5,6,7,8,9,10,11,23))
> 
> but when I tried to to run the aggregate function on this
> subset:
> 
> > aggregate(s.all, list(sc_recov), mean)
> 
> The result is garbage (i.e. its not grouping the data). So
> then I took my
> "all.csv", removed the unwanted columns and
> imported it into R as "small".
> 
> > aggregate(small, list(sc_recov), mean)
> Error in FUN(X[[1L]], ...) : arguments must have same
> length
> 
> Any thoughts?
> 
> Thank you kindly,
> M Just
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> 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.


      __________________________________________________________________
[[elided Yahoo spam]]



More information about the R-help mailing list