Check if the provided object is of certain type
Arguments
- object
An object or an atomic vector or a list of objects.
- type
A single string or a vector of string representation or class of the type that should be checked for.
- nullAllowed
Boolean flag if
NULL
is accepted for theobject
. IfTRUE
,NULL
always returnsTRUE
, otherwiseNULL
returnsFALSE
. Default isFALSE
.
Examples
# checking type of a single object
df <- data.frame(x = c(1, 2, 3))
isOfType(df, "data.frame")
#> [1] TRUE