-
Notifications
You must be signed in to change notification settings - Fork 420
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"wipwork in progresswork in progress
Description
library(tidyr)
packageVersion("tidyr")
#> [1] '0.8.0.9000'
x_fac <- factor(c(1, NA), exclude = NULL)
levels(x_fac)
#> [1] "1" NA
x_cross <- crossing(x_fac)
levels(x_cross$x_fac)
#> [1] "1"The root of this seems to be in ulevels():
ulevels(factor(c(1, NA), exclude = NULL))
#> [1] 1 <NA>
#> Levels: 1Adding exclude = NULL in factor() inside ulevels() solves the issue (and passes all current tests).
If this is an unintended behavior, I am ready to make a PR.
Reactions are currently unavailable
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"wipwork in progresswork in progress