| tobool | R Documentation | 
Flexible boolean conversion. Author: Bryce Chamberlain.
tobool(
  x,
  preprocessed.values = NULL,
  nastrings = easyr::nastrings,
  ifna = c("return-unchanged", "error", "warning", "return-na"),
  verbose = TRUE,
  true.vals = c("true", "1", "t", "yes"),
  false.vals = c("false", "0", "f", "no")
)
x | 
 Value or vector to be converted.  | 
preprocessed.values | 
 Strings need to have NAs set, lowercase and be trimmed before they can be checked. To avoid doing this multiple times, you can pass these processed values to the function.  | 
nastrings | 
 Vector of characters to be considered NAs. todate will treat these like NAs. Defaults to the easyr::nastrings list.  | 
ifna | 
 Action to take if NAs are created. 'return-unchanged' returns the sent vector unchanged; 'warning' results in a warning and returns the converted vector with new NAs; 'error' results in an error.  | 
verbose | 
 Choose to view messaging.  | 
true.vals | 
 Values to consider as TRUE.  | 
false.vals | 
 Values to consider as FALSE.  | 
Converted logical vector.
tobool( c( 'true', 'FALSE', 0, 1, NA, 'yes', 'NO' ) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.