pivot_longer()
should allow for varying the columns slower than the rows
#1312
Labels
pivot_longer()
should allow for varying the columns slower than the rows
#1312
I was somewhat surprised at the
pivot_longer()
results below. It seems to attempt to keep the row values close together (i.e. the original row 1 values became the new row 1 and 2 values), when really I wanted to keep the column values together (i.e. the original column 1 values became the new row 1 and row 2 values).This seems very related to
names_vary
inpivot_wider()
, but I don't quite think the name is exactly right here.I think a good name might actually be
cols_vary = "fastest"
(i.e. it iterates through all the columns before moving on to the next row). This goes nicely with thecols
argument.Implementation wise, I think we need to not interleave here:
tidyr/R/pivot-long.R
Lines 259 to 265 in 48ba23d
And then maybe use
vec_rep_each()
here instead ofvec_rep()
(that feels very similar to hownames_vary
works)tidyr/R/pivot-long.R
Line 274 in 48ba23d
The text was updated successfully, but these errors were encountered: