missing documentation for passing additional arguments to values_fn in pivot_wider() #1114
Labels
bug
an unexpected problem or unintended behavior
documentation
pivoting ♻️
pivot rectangular data to different "shapes"
I was trying to figure out how to pass additional arguments to a function used in values_fn in pivot_wider().
Looking at the documentation I couldn't find any clues.
I tried several methods, inspired by what I did find in the documentation ({.value}), and other tidyverse functions (purrr, across).
I ended up with two methods that did work, using an unnamed function, and a predefined custom function, so the coding issue is solved, but the documentation is lacking..
Posting here so others could find the solution. Also, in case someone would like to change the functionality and accept additional syntax for the arguments of values_fn.
Others that came across this issue: https://community.rstudio.com/t/values-fn-length-in-pivot-wider-gives-null-length-na-instead-of-zero/95976
The reprex shows what works, and what doesn't..
Created on 2021-04-12 by the reprex package (v1.0.0)
The text was updated successfully, but these errors were encountered: