validate_types {safeframe}R Documentation

Type check variables

Description

This function checks the type of variables in a safeframe against accepted classes. Only checks the type of provided variables and ignores those not provided.

Usage

validate_types(x, ...)

Arguments

x

a safeframe object

...

<dynamic-dots> A named list with tags in x as list names and the related types as list values.

Value

A named list.

See Also

Examples

x <- make_safeframe(cars,
  mph = "speed",
  distance = "dist"
)
x

## the below would issue an error
## note: tryCatch is only used to avoid a genuine error in the example
tryCatch(validate_types(x), error = paste)

## to allow other types, e.g. gender to be integer, character or factor
validate_types(x, mph = "numeric", distance = c(
  "integer",
  "character", "numeric"
))


[Package safeframe version 1.0.0 Index]