has_all_names

0th

Percentile

Returns TRUE if data.frame or list has specified names

This function checks parent frame environment for existence of names. This is meant to be used with `assertr`'s `verify` function to check for the existence of specific column names in a `data.frame` that is piped to `verify`. It can also work on a non-`data.frame` list.

Usage
has_all_names(...)
Arguments
...

A arbitrary amount of quoted names to check for

Value

TRUE is all names exist, FALSE if not

See Also

exists

Aliases
  • has_all_names
Examples
# NOT RUN {
verify(mtcars, has_all_names("mpg", "wt", "qsec"))

library(magrittr)   # for pipe operator

# }
# NOT RUN {
mtcars %>%
  verify(has_all_names("mpgg"))  # fails
# }
# NOT RUN {
mpgg <- "something"

mtcars %>%
  verify(exists("mpgg"))   # passes but big mistake

# }
# NOT RUN {
mtcars %>%
  verify(has_all_names("mpgg")) # correctly fails
# }
# NOT RUN {
# }
Documentation reproduced from package assertr, version 2.7, License: MIT + file LICENSE

Community examples

Looks like there are no examples yet.