-
Notifications
You must be signed in to change notification settings - Fork 116
Closed
Description
This issue is a port of tidyverse/ggplot2#5224.
The following behaviour is unexpected, where the order of items in the range is rearranged.
library(scales)
f <- factor(c("A", "B", "C", NA), levels = c("C", "B", "A"))
range <- DiscreteRange$new()
range$train(na.omit(f))
# This is fine
range$range
#> [1] "C" "B" "A"
range$train(f)
# This is unexpected
range$range
#> [1] "A" "B" "C"If we flip the order in which the range is trained, everything seems to work as expected:
range$reset()
range$train(f)
range$range
#> [1] "C" "B" "A" NA
range$train(na.omit(f))
range$range
#> [1] "C" "B" "A" NA
Created on 2023-03-28 with reprex v2.0.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels