
Checks dimension of an object.
check_dim(x, dim = length, values = numeric(0), x_name = NULL, dim_name = NULL)
The object to check.
A function returning a non-negative whole number of the dimension.
A flag or a whole numeric vector of the value, value range or possible values.
A string of the name of object x or NULL.
A string of the name of the dim function.
An informative error if the test fails.
Other check:
check_data()
,
check_key()
,
check_names()
,
check_values()
# NOT RUN {
check_dim(1)
try(check_dim(1, values = FALSE))
try(check_dim(1, values = c(10, 2)))
try(check_dim(data.frame(x = 1), dim = nrow, values = c(10, 10, 2)))
# }
Run the code above in your browser using DataLab