[R] count and sum simultaneously in R pivot table

bcrombie bcrombie at utk.edu
Thu Feb 6 22:32:26 CET 2014


Based on the following code, how can I add a column to this pivot table
output that will count CaseID's for each variable sum?  CaseID is a factor.

# library(reshape)
# FLSA_Violation_Reason_melt <- melt(FLSA_ViolRsnfixed, 
#                                    id=c("CaseID", "ViolationDesc",
"ReasonDesc"),
#                                    measure=c("BW_Due", "BW_ATP",
"EEs_Rep"))
# 
# FLSA_Violation_Reason_cast <- cast(FLSA_Violation_Reason_melt, 
#                                    ViolationDesc + ReasonDesc ~ variable,
#                                    sum, margins=TRUE)

Thank you.



--
View this message in context: http://r.789695.n4.nabble.com/count-and-sum-simultaneously-in-R-pivot-table-tp4684896.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list