search for: out_gr2

Displaying 1 result from an estimated 1 matches for "out_gr2".

Did you mean: out_gr1
2011 Apr 30
1
More flexible aggregate / eval
....name(xvar)), time), FUN = function(x) round(prop.table(x) * 100, 1) ) ) op2 <- xtabs(l_pct ~ eval(as.name(xvar)) + ids + time, data = d2) fop2 <- ftable(op2, row.vars=c(1,3)) out <- list(d2, fop2) return(out) } ( out_gr1 <- myfun(df, "group1") ) ( out_gr2 <- myfun(df, "group2") ) ( out_gr3 <- myfun(df, "group3") ) This seems to work ok, but I am not really familiar with 'as.formula', 'eval' and 'as.name'. So I would like to know, if my solution is ok or if there are maybe better ways to solve this...