-
Notifications
You must be signed in to change notification settings - Fork 418
Closed
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorpivoting ♻️pivot rectangular data to different "shapes"pivot rectangular data to different "shapes"
Description
library(tidyr)
pivot_wider(fish_encounters[1,], names_from = station, values_from = seen)
#> # A tibble: 1 × 2
#> fish Release
#> <fct> <int>
#> 1 4842 1
# Doesn't drop `seen`, but dropped `station`
pivot_wider(fish_encounters[0,], names_from = station, values_from = seen)
#> # A tibble: 0 × 2
#> # … with 2 variables: fish <fct>, seen <int>
# Works if you explicitly state the `id_cols`
pivot_wider(fish_encounters[0,], id_cols = fish, names_from = station, values_from = seen)
#> # A tibble: 0 × 1
#> # … with 1 variable: fish <fct>
I think I am expecting just an empty fish
column
Metadata
Metadata
Assignees
Labels
bugan unexpected problem or unintended behavioran unexpected problem or unintended behaviorpivoting ♻️pivot rectangular data to different "shapes"pivot rectangular data to different "shapes"