check_col_names | R Documentation |
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)
data |
tbl. Data frame to check for the column name. |
names |
character vector, The name(s) of the column to check for. |
NULL. The function will abort with an error if the column name already exists.
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"))
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.