Feature request: Can pivot_wider() have an option to preserve non-id_cols column by chopping into list columns?
#990
Labels
id_cols column by chopping into list columns?
#990
(I asked this on RStudio Community first, but couldn't get a nice answer. So I thought this is worth a feature request.)
At first, honestly I didn't feel it's useful that
pivot_wider()creates list columns when there are any duplicated values. But, now I find it very useful, in that it allows us to delay the decision of how to handle the duplication. This request is basically about extending it to non-id_colscolumn.Suppose I have this data:
and want to
keyto columns andupdateof eachidat the same time. Currently, I can achieve this by summarising
updatewithmutate()beforehand:This is fine. But, I wander if it's possible that
pivot_wider()chops non-id_colscolumn into a list column instead of just dropping. If it does, I can takemax()s of them. Here's a pseudo-code;updateisn't specified either onid_cols,names_from, orvalues_from), so it gets dropped, but I want to preserve the column.Or, more simply, this:
The text was updated successfully, but these errors were encountered: