[R] Adding rows based on column value

Ben Bolker bbolker at gmail.com
Thu Jul 14 19:24:52 CEST 2011


Bansal, Vikas <vikas.bansal <at> kcl.ac.uk> writes:

> I am using this-
> 
> aggregate(x = file[,3:6], by = list(file[,2]), FUN = "sum")
> 

  Better, although still not reproducible (please *do* read the posting
guide -- it is listed at the bottom of every R list post and is the
*first* google hit for "posting guide" (!); search for
"Examples").  What about removing the quotation marks around "sum"?

  aggregate(x = file[,3:6], by = list(file[,2]), FUN = sum)


> but I think this is not a right way.
> Because we cannot use "sum" to add.That is
>  why I was asking for help.



More information about the R-help mailing list