Validity check capable of validating multiple slots in a single call.

validateClasses(object, expected, subset = FALSE)

Arguments

object

Object.

expected

list. Named list of expected classes per slot.

subset

logical(1). Only check a subset of slots in the object.

Value

logical(1) (TRUE) on sucess or character(1) containing informative message on failure.

Details

To be used inside S4 setValidity() call or with validate(). Particularly useful for checking multiple slotted objects inside metadata().

Note

Updated 2019-07-29.

See also

Examples

validateClasses( object = list( a = character(), b = integer(), c = factor() ), expected = list( a = "character", b = "integer", c = "factor" ) )
#> [1] TRUE