Type checks - Other types
predicates-other-types.RdTest if object is of a specific type (typeof()). The test is invariant to
attributes such as class. The general is_type() checks for any
user-supplied type.
See the Details section for the full list of types.
Functions from rlang: rlang::is_null(), rlang::is_weakref().
Usage
is_type(x, type, n = NULL)
is_null()
is_promise(x)
is_dots(x, n = NULL)
is_weakref(x)
is_bytecode(x)
is_externalptr(x)
is_char(x)
is_any(x)Arguments
- x
[
any] An object to test.- type
[
character(1)] A type to test for, as returned bytypeof().- n
[
integer(1)|NULL] Length ofx, set toNULLto not test.
Details
The full list of R object types (typeof()) can be seen in "R Internals" section 1.1.3.
The existing types and their corresponding C SEXP types are:
Atomic vectors: "logical"/LGLSXP, "integer"/INTSXP, "double"/"numeric"/REALSXP, "complex"/CPLXSXP, "raw"/RAWSXP.
Lists: "list"/VECSXP, "pairlist"/LISTSXP.
Objects: "s4"/S4SXP, "object"/OBJSXP.
Language-related: "symbol"/"name"/SYMSXP, "language"/LANGSXP, "expression"/EXPRSXP.
Functions: "closure"/CLOSXP, "builtin"/SPECIALSXP, "special"/BUILTINSXP.
Promises: "promise"/PROMSXP, "..."/DOTSXP.
Environments: "environment"/ENVSXP.
Null: "NULL"/NILSXP.
Bytecode: "bytecode"/BCODESXP.
External pointer: "externalptr"/EXTPTRSXP.
Weak reference: "weakref"/WEAKREFSXP.
Internal-only: "char"/CHARSXP, "any"/ANYSXP.