If the columns are contiguous, then try the following: (you will have to determine the range to use)
aggregate(dstats[,c(3:25)],list(dstats$Year,dstats$HD),FUN=sum) On Tue, Dec 27, 2011 at 2:22 PM, William Dunlap <wdun...@tibco.com> wrote: > Your command includes (at about character position 240): > 'R.N.S.1ST',R.N.S.2ND' > Note the missing quote after the comma. > > When R's error message starts with > Error: > instead of > Error in <command>: > it usually means it could not parse the text that you typed > to make a command out of it. (Perhaps it should say 'Error > while parsing input text'.) > > Bill Dunlap > Spotfire, TIBCO Software > wdunlap tibco.com > >> -----Original Message----- >> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On >> Behalf Of steven.hazen >> Sent: Tuesday, December 27, 2011 10:01 AM >> To: r-help@r-project.org >> Subject: Re: [R] Summing Data in R >> >> Yes that is what I'm trying to do, however when I enter the code >> >> aggregate(dstats[,c('QUOTA','L.R.QTA','L.R.A.1ST','L.R.S.1ST','L.N.QTA','L.N.A.1ST','L.N.S.1ST','R.R.Q >> TA','R.R.A.1ST','R.R.A.2ND','R.R.A.3RD','R.R.S.1ST','R.R.S.2ND','R.R.S.3R','R.N.QTA','R.N.A.1ST','R.N. >> A.2ND','R.N.A.3RD','R.N.S.1ST',R.N.S.2ND','R.N.S.3RD','T.SUCCESS','T.SURPLUS')],list(dstats$Year,dstat >> s$HD),FUN=sum) >> >> I'm getting an error message saying: >> >> Error: unexpected string constant in >> "aggregate(dstats[,c('QUOTA','L.R.QTA','L.R.A.1ST','L.R.S.1ST','L.N.QTA','L.N.A.1ST','L.N.S.1ST','R.R. >> QTA','R.R.A.1ST','R.R.A.2ND','R.R.A.3RD','R.R.S.1ST','R.R.S.2ND','R.R.S.3R','R.N.QTA','R.N." >> > >> Any suggestions on how to fix this? >> >> Thanks, >> Steve >> >> -- >> View this message in context: >> http://r.789695.n4.nabble.com/Summing-Data-in-R-tp4237650p4237796.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. -- Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. ______________________________________________ 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.