assert_cols | R Documentation |
Asserts that a data frame contains the specified columns.
assert_cols(
data,
cols = NULL,
strict = FALSE,
obj_name = checkmate::vname(data)
)
data |
Data frame to check. |
cols |
Column names which must be present in |
strict |
Whether additional columns not specified in |
obj_name |
Name of the checked object to print in error messages. |
data
, invisibly.
Other data frame / tibble functions:
is_equal_df()
,
reduce_df_list()
pal::assert_cols(data = mtcars,
cols = c("mpg", "disp"))
try(
pal::assert_cols(data = mtcars,
cols = c("mpg", "display"))
)
try(
pal::assert_cols(data = mtcars,
cols = c("mpg", "disp"),
strict = TRUE)
)
try(
pal::assert_cols(data = mtcars,
strict = TRUE)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.