View source: R/check_for_column.R
check_for_column | R Documentation |
check for specified columns and corresponding column types
check_for_column(d, column_name, column, column_type = NULL)
d |
input dataframe |
column_name |
character string defining name of column to be checked |
column |
character vector to be checked (e.g., d$column_name) |
column_type |
(optional) desired column type to be checked for (e.g., 'character') |
if column_name exists in d and is of the correct column_type, nothing is returned. if column_name does not exist in d, an error is thrown. if column is not of the correct column_type, a warning is shown.
## Not run:
d <- tibble::tribble(
~"id", ~"value",
"123", 123,
"456", 456
)
check_for_column(d, "id", d$id, "double")
check_for_column(d, "id2", d$id2, "double")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.