tklebel / crosstabr

Cross tabulation with HTML and Markdown output
Other
1 stars 0 forks source link

add layer to cross_table #6

Open tklebel opened 8 years ago

tklebel commented 8 years ago

cross_table should have a separate argument layer, where you can specify a third variable, which you want to control for. This seems easier to remember than to add another variable to the input-formula.

tklebel commented 8 years ago

We could make use of group_by, grouped tibbles and so forth.

Should we allow this?

data %>%
  group_by(~ group) %>%
  crosstab(dep ~ indep)

Or rather?

data %>%
  crosstab(dep ~ indep, group/layer = ~group)
tklebel commented 8 years ago

Should we allow several layers of grouping, eg: group_by(var1, var2)? Would that make sense, would there be a valid use case?

In case not, issue a warning for grouped tibbles with more than one grouping var.