Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

has_cols

Does the input have rows/columns?


Description

Checks to see if the input has rows/columns.

Usage

assert_has_cols(x, severity = getOption("assertive.severity", "stop"))

assert_has_rows(x, severity = getOption("assertive.severity", "stop"))

has_cols(x, .xname = get_name_in_parent(x))

has_rows(x, .xname = get_name_in_parent(x))

Arguments

x

Input to check.

severity

How severe should the consequences of the assertion be? Either "stop", "warning", "message", or "none".

.xname

Not intended to be used directly.

Value

has_rows and has_cols return TRUE if nrow and ncol respectively return a value that is non-null and positive. The assert_* functions return nothing but throw an error if the corresponding has_* function returns FALSE.

See Also

Examples

assert_has_rows(data.frame(x = 1:10))
assert_has_cols(matrix())

assertive.properties

Assertions to Check Properties of Variables

v0.0-4
GPL (>= 3)
Authors
Richard Cotton [aut, cre]
Initial release
2016-12-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.