has_class {assertr} | R Documentation |
Returns TRUE if data.frame columns have a specified class
Description
This is meant to be used with ‘assertr'’s 'verify' function to check for the existence of a specific column class in a 'data.frame' that is piped to 'verify'.
Usage
has_class(..., class)
Arguments
... |
An arbitrary amount of quoted column names to check for |
class |
Expected class for chosen columns. |
Value
TRUE if all classes are correct, FALSE if not
Examples
verify(mtcars, has_class("mpg", "wt", class = "numeric"))
library(magrittr) # for pipe operator
## Not run:
mtcars %>%
verify(has_class("mpg", class = "character")) # fails
## End(Not run)
[Package assertr version 3.0.1 Index]