Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] ordered factors in tibbles can't be imputed #72

Open
mayer79 opened this issue Jul 27, 2024 · 0 comments
Open

[Bug] ordered factors in tibbles can't be imputed #72

mayer79 opened this issue Jul 27, 2024 · 0 comments
Assignees
Labels

Comments

@mayer79
Copy link
Owner

mayer79 commented Jul 27, 2024

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.

@mayer79 mayer79 self-assigned this Jul 27, 2024
@mayer79 mayer79 added the bug label Jul 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant