-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Labels
Description
The following code raises an error:
library(missRanger)
library(ggplot2)
imp <- missRanger(diamonds |> generateNA(seed = 1))
# Error
in `[<-`:
! Assigned data `pred` must be compatible with existing data.
ℹ Error occurred for column `cut`.
Caused by error in `vec_assign()`:
! Can't convert <factor<ff2b9>> to <ordered<ff2b9>>.
Run `rlang::last_trace()` to see where the error occurred.The problem does not occur when:
- diamonds is converted to a normal data.frame
- Predictive mean matching is used via
pmm.k > 0 - The ordered factor is turned into an unordered factor
Tibbles seem to be picky with ordered factors in subset-assignment.