types.castBoolean: Cast boolean

View source: R/types.castBoolean.R

types.castBooleanR Documentation

Cast boolean

Description

Cast boolean values

Usage

types.castBoolean(
  format = "default",
  value,
  options = {
 }
)

Arguments

format

no options (other than the default)

value

boolean to cast

options

specify additioanl true values or/and falsevalues

Details

In the physical representations of data where boolean values are represented with strings, the values set in trueValues and falseValues are to be cast to their logical representation as booleans. trueValues and falseValues are lists which can be customised to user need. The default values for these are in the additional properties section below.

The boolean field can be customised with these additional properties:

  • trueValues: ["true", "True", "TRUE", "1"]

  • falseValues: ["false", "False", "FALSE", "0"]

See Also

Types and formats specifications

Examples


types.castBoolean(format = "default", value =  TRUE)

types.castBoolean(format = "default", value = "true")

types.castBoolean(format = "default", value = "1")

types.castBoolean(format = "default", value = "0")

# set options with additional true value
types.castBoolean(format = "default", value = "yes", list(trueValues = list("yes")))

# set options with additional false value
types.castBoolean(format = "default", value = "no", list(falseValues  = list("no")))


frictionlessdata/tableschema-r documentation built on Oct. 1, 2022, 11:44 a.m.