I have tried that also.But it is showing this error- aggregate(file[,3:6], by = list(file[,2]), FUN = sum)
Error in FUN(X[[1L]], ...) : invalid 'type' (character) of argument Thanking you, Warm Regards Vikas Bansal Msc Bioinformatics Kings College London ________________________________________ From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Ben Bolker [bbol...@gmail.com] Sent: Thursday, July 14, 2011 6:24 PM To: r-h...@stat.math.ethz.ch Subject: Re: [R] Adding rows based on column value 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. ______________________________________________ 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.