Displaying 1 result from an estimated 1 matches for "mydatasum".
2012 Jan 01
1
How to pass in a list of variables as an argument to a function?
...nction below with an object?
myData = transform(myData, groupVar = paste(varA, varB, varC, sep = " | "))
# Sum the data by the same groupVars and two other variables
# Question 2: ?Is there a way to replace "varA + varB + varC" in the
function below and do the same aggregation?
myDataSum <- aggregate(cbind(pass, fail) ~ varA + varB + varC +
groupVar + varD, data = myData, sum)
# pivot the pass and fail quantity to one row per group, ?labelling them
# Question 3: ?This one actually works. ?idvar happily accepted the
vector of group vars. ?Better way?
myDataSum <- reshape(myDa...