R - isTRUE(): check if exactly TRUE and length 1

26 Aug 2017

x <- TRUE
isTRUE(x)
# [1] TRUE

y <- c(TRUE, TRUE)
isTRUE(y) 
# [1] FALSE

x <- c("hello")
isTRUE(x) 
# [1] FALSE

x <- c(1)
isTRUE(x) 
# [1] FALSE

isTRUE(1) 
# [1] FALSE

viewed on http://www.rfunction.com

[ R  function  logic  ]