Skip to content

Commit

Permalink
Ensure missing reason column is always a factor
Browse files Browse the repository at this point in the history
  • Loading branch information
khusmann committed Mar 2, 2024
1 parent 088c57e commit 2083f57
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/coalesce_missing_reasons.R
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ coalesce_missing_reasons <- function(
missing_values <- x[[missing_name]] %||%
if_else(is.na(values), default_reason, NA)

# Ensure missing reason column is always a factor
if (!is.factor((missing_values))) {
missing_values <- factor(missing_values)
}

if (keep == "values") {
new_values <- values

Expand Down

0 comments on commit 2083f57

Please sign in to comment.