Skip to content

Commit

Permalink
simplify again [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebacher committed Dec 1, 2024
1 parent 62631e6 commit 5d00d9c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions R/data_rename.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ data_rename <- function(data,
# Forbid partially named "select",
# Ex: if select = c("foo" = "Species", "Sepal.Length") then the 2nd name and
# 2nd value are "Sepal.Length"
if (!is.null(names(select))) {
if (any(names(select) == select)) {
insight::format_error("When `select` is a named vector, all elements must be named.")
}
if (!is.null(names(select)) && any(names(select) == select)) {
insight::format_error("When `select` is a named vector, all elements must be named.")
}

# check if `select` has names, and if so, use as "replacement"
Expand Down

0 comments on commit 5d00d9c

Please sign in to comment.