Open moodymudskipper opened 4 years ago
The expand
argument is similar, and expand = by
would be a lot like drop = FALSE
in dcast
by, margins, expand and fill must be in that order and applied in that order
I'd like to figure out if possible a universal syntax to show exactly the desired combinations of all vs groups for any combination. This syntax should still be simple for common cases!
Also we didn't discuss the actual value of the margin, it's (all)
in reshape2 but would be good to be able to mention it, especially for group columns that are not character!
dcast
offers a margin feature, so we can group by "all" and group by categories and get the rbinded result.It also offers a margin column but I think we don't need those as we can cumulate a spread with an aggregating call easily.
The margin row however is useful for spread AND summarizing, it is linked to the by variables, so could be :
by
, very similar to dcastThe latter calls for new weird grammar for a feature that is not all so common.
I think better use the former, we could use
s()
etc there, and they'd apply onby
columns only, somargin = ?".*"
means use margins for all (ormargin = by
for that matter!).In case of multiple margin columns, we will show all possibilities, if we only want the groups AND the ungrouped summary we could have a special value for margins, like
Inf
, or"*something_unlikely_or_non_syntactic*"