Learn R Programming

ospsuite.utils (version 1.2.0)

isOfType: Check if the provided object is of certain type

Description

Check if the provided object is of certain type

Usage

isOfType(object, type, nullAllowed = FALSE)

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 the object. If TRUE, NULL always returns TRUE, otherwise NULL returns FALSE. Default is FALSE.

Value

TRUE if the object or all objects inside the list are of the given type.

Examples

Run this code
# NOT RUN {
# checking type of a single object
df <- data.frame(x = c(1, 2, 3))
isOfType(df, "data.frame")
# }

Run the code above in your browser using DataLab