[R] Summing Data in R

David Winsemius dwinsemius at comcast.net
Tue Dec 27 20:16:24 CET 2011


On Dec 27, 2011, at 1:01 PM, steven.hazen wrote:

> 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.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.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,dstats$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?

Yes. Don't mix single and double quotes.

-- 
David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list