Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
check variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
TiagoOlivoto committed Jan 26, 2021
1 parent e47d533 commit 32e088a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/utilities.R
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,9 @@ column_to_rownames <- function(.data, var = "rowname"){
df <-
as.data.frame(.data) %>%
remove_rownames()
if(!var %in% colnames(df)){
stop("Variable '", var, "' not in data.", call. = FALSE)
}
rownames(df) <- df[[var]]
df[[var]] <- NULL
df
Expand Down

0 comments on commit 32e088a

Please sign in to comment.