assert_has_colnames

Does the input have names?

Checks to see if the input has (row/column/dimension) names.

Usage
assert_has_colnames(x, severity = getOption("assertive.severity", "stop"))
assert_has_dimnames(x, severity = getOption("assertive.severity", "stop"))
assert_has_names(x, severity = getOption("assertive.severity", "stop"))
assert_has_rownames(x, severity = getOption("assertive.severity", "stop"))
has_colnames(x, .xname = get_name_in_parent(x))
has_dimnames(x, .xname = get_name_in_parent(x))
has_names(x, .xname = get_name_in_parent(x))
has_rownames(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_names returns TRUE if names is non-null. has_rownames, has_colnames and has_dimnames work in a similar fashion, checking the corresponding attributes. assert_has_names returns nothing but throws an error if has_names is not TRUE.

Note

Empty names (i.e., "") are not allowed in R, and are not checked here.

See Also

names, rownames, colnames, dimnames.

Aliases
  • assert_has_colnames
  • assert_has_dimnames
  • assert_has_names
  • assert_has_rownames
  • has_colnames
  • has_dimnames
  • has_names
  • has_rownames
Examples
library(assertive.properties) assert_has_names(c(a = 1, 2)) dfr <- data.frame(x = 1:5) assert_has_rownames(dfr) assert_has_colnames(dfr) assert_has_dimnames(dfr)
Documentation reproduced from package assertive.properties, version 0.0-4, License: GPL (>= 3)

Community examples

Looks like there are no examples yet.