as.logic: Convert character to logical

Description Usage Arguments Details Value See Also Examples

View source: R/as.logic.R

Description

Converts vector to logical based on user specified parameters for the TRUE and false values

Usage

1
2
3
4
5
as.logic(x, true = TRUE, false = FALSE)

as.logicYN(x)

p_yn(x)

Arguments

x

vector to convert to logical

true

Value(s) mapped to TRUE

false

Value(s) mapped to FALSE

Details

as.logic coerces x into a logical vector in which the values of specified by true become TRUE. etc. Values not identified by true or false become NA

Value

logical vector version of x.

See Also

as.logical
logical
NA

Examples

1
2
3
4
   as.logic( iris$Species, true="setosa", false="virginica" )  
    
  yn <- c( "Yes", "NO", "Y", "n" )
  as.logicYN(yn)

decisionpatterns/coercion documentation built on Nov. 4, 2019, 10:23 a.m.