Skip to content

add_case/add_row silently converts factors to strings  #1543

Open
@vorpalvorpal

Description

@vorpalvorpal

If you provide a character vector to a column that is currently a factor add_case changes the column class to character.

tibble(col = fct(NA_character_, levels = c("A", "B"))) |>
    add_case(col = "A")

I feel like this should, at the very least, produce a warning rather than just silently changing the class of the column. Possibly it should even change "A" to to fct("A") with a warning.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions