assert_is_externalptr {assertive.types}R Documentation

Is the input is an external pointer?

Description

Check whether the input is an external pointer. that is, an object of class ("externalptr").

Usage

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

is_externalptr(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

is_externalptr wraps is.data.frame, providing more information on failure. assert_is_externalptr returns nothing but throws an error if is_externalptr returns FALSE.

Examples

# The xml2 pkg makes heavy use of external pointers
xptr <- xml2::read_xml("<foo><bar /></foo>")$node
assert_is_externalptr(xptr)

# This should fail
assertive.base::dont_stop({
assert_is_externalptr(NULL)
})

[Package assertive.types version 0.0-3 Index]