powered by
This function checks if a column name already exists in a data frame. If the column name already exists, the function will abort with an error.
check_col_names(data, names)
NULL. The function will abort with an error if the column name already exists.
tbl. Data frame to check for the column name.
character vector, The name(s) of the column to check for.
data <- tibble::tibble(a = NA, b = NA, c = NA) try({ check_col_names(data, c("a", "b", "c")) check_col_names(data, c("a", "d")) })
Run the code above in your browser using DataLab