Skip to content

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

@mayer79

Description

@mayer79

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.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions