Learn R Programming

tableschema.r (version 1.1.2)

types.castBoolean: 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

Examples

Run this code

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")))

Run the code above in your browser using DataLab