Skip to content

Commit

Permalink
obvious
Browse files Browse the repository at this point in the history
  • Loading branch information
maelle committed Jul 26, 2023
1 parent 2944367 commit 69e3e93
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions R/spq_rename_var.R
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
spq_rename_var <- function(.query, old, new) {
# error if the old variable name is not in vars

if (!(question_mark(old) %in% .query[["vars"]][["name"]])) {
cli::cli_abort("Can't rename {.field {old}} as it's not present in the query object.")
}

# error if the new variable name is in vars
if (question_mark(new) %in% .query[["vars"]][["name"]]) {
cli::cli_abort("Can't rename {.field {old}} to {.field {new}} as {.field {new}} already exists.")
}
Expand Down

0 comments on commit 69e3e93

Please sign in to comment.