Skip to content

Commit

Permalink
Only handle character case in internal replace_setnames_na
Browse files Browse the repository at this point in the history
  • Loading branch information
markfairbanks committed Oct 20, 2022
1 parent 7f25ae4 commit 2c8763b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions R/step-setnames.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,9 @@ step_setnames <- function(x, old, new, in_place, rename_groups = FALSE) {
}

# Replace character `NA` names with "NA"
# Replace position `NA` with column position
replace_setnames_na <- function(x) {
if (is.character(x)) {
vctrs::vec_assign(x, is.na(x), "NA")
} else {
is_na <- is.na(x)
na_locs <- seq_along(x)[is_na]
vctrs::vec_assign(x, is_na, na_locs)
x <- vctrs::vec_assign(x, is.na(x), "NA")
}
x
}

0 comments on commit 2c8763b

Please sign in to comment.