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.dat
r-help@r-project.org
Cc: Crombie, Burnette N
Subject: Re: [R] count and sum simultaneously in R pivot table
Hi,
Check if this works:
library(reshape2)
res1 <- acast(FLSAdata_melt, ViolationDesc + ReasonDesc ~ variable, sum,
margins=TRUE)[,-4]
res2 <- within(as.data.frame(res1),`Count
Hi,
Check if this works:
library(reshape2)
res1 <- acast(FLSAdata_melt, ViolationDesc + ReasonDesc ~ variable, sum,
margins=TRUE)[,-4]
res2 <- within(as.data.frame(res1),`Count of Case ID` <- dcast(FLSAdata_melt,
ViolationDesc + ReasonDesc ~ variable, length, margins=TRUE)[,3])[,c(4,1:3)]
colna
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",
"Reas
4 matches
Mail list logo