rgrannell1 / kea

Composable Functional Programming in R
16 stars 3 forks source link

Create fast replacement for `isTRUE` #59

Open rgrannell1 opened 10 years ago

rgrannell1 commented 10 years ago

isTRUE takes about 627 nanoseconds, while a boolean check takes about 174 nanoseconds. isTRUE calls down to identical, so it should be possible to make a fast replacement just for logical values.

is_true(TRUE)   => TRUE
is_true(FALSE ) => FALSE
is_true(NA)     => FALSE

is_true(_)      => Error