strict: Strict assignment by class or type

View source: R/type_check.R View source: R/strict.R

strictR Documentation

Strict assignment by class or type

Description

Allow assignment only if input is of correct class and/or type

Usage

strict(object, class, allow_null = TRUE)

strict(object, class, allow_null = TRUE)

Arguments

object

Object to check and return

class

Character vector: class(es) to check against

allow_null

Logical: if TRUE, allows NULL objects

x

Value to be assigned if class and/or type check passes

accept.class

Required class of x

accept.type

Required type of x

non.null.val

Function which should have a non-null value when applied to x

Value

Object

Author(s)

E.D. Gennatas

EDG

Examples

## Not run: 
strict("papaya", "character") # "papaya"
strict(c(1, 2.5, 3.2), "integer") # Error
strict(iris, "list") # Error

## End(Not run)

egenn/rtemis documentation built on Dec. 17, 2024, 6:16 p.m.