tibble
tibble copied to clipboard
add_case/add_row silently converts factors to strings
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.
Thanks. The underlying function is vctrs::vec_rbind(), this behavior is consistent with vctrs principles.