[R] count and sum simultaneously in R pivot table

Crombie, Burnette N bcrombie at utk.edu
Tue Feb 18 17:18:20 CET 2014

The script works nicely, Arun.  You were right, I pasted code from email instead of Rhelp and didn't reformat properly in R.  I appreciate your time with this!

-----Original Message-----
It seems like part of the next line is also being run (in the end 'colnames').
For e.g.
res2 <- within(as.data.frame(res1),`Count of Case ID` <- dcast(FLSAdata_melt, ViolationDesc + ReasonDesc ~ variable, length, margins=TRUE)[,3])[,c(4,1:3)] colnames
#Error: unexpected symbol in "res2 <- within(as.data.frame(res1),`Count of Case ID` <- #dcast(FLSAdata_melt, ViolationDesc + ReasonDesc ~ variable, length, margins=TRUE)#[,3])[,c(4,1:3)] colnames"

More information about the R-help mailing list