is_externalptr: Is the input is an external pointer?

Description Usage Arguments Value Examples

View source: R/is-type-base.R

Description

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

Usage

1
2
3
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

1
2
3
4
5
6
7
8
# 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)
})

assertive.types documentation built on May 1, 2019, 10:31 p.m.