df_like {dataclass} | R Documentation |
Validator: Check if element is a data like object
Description
This function is used to check whether something is data like. You can use this function to check the data row count. You can also specify the level of a violation. If level is set to "warn" then invalid inputs will warn you. However, if level is set to "error" then invalid inputs will abort.
Usage
df_like(max_row = Inf, min_row = 1, level = "error")
Arguments
max_row |
The maximum row count of a data element |
min_row |
The minimum row count of a data element |
level |
Setting "warn" throws a warning, setting "error" halts |
Value
A function with the following properties:
* Checks whether something is a data frame like object * Determines whether the check will throw warning or error * Optionally checks for row count
Examples
# Define a dataclass for testing data:
my_dataclass <-
dataclass(
df = df_like(100)
)
# `df` must be a data like object with at most 100 rows!
my_dataclass(
df = mtcars
)
[Package dataclass version 0.3.0 Index]