Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
55 lines (40 sloc) 1.42 KB

Travis-CI Build Status Coverage Status

sillylogic

Emote via Logical Constants

Inspired by the discussion on Twitter, sillylogic provides some fun alternatives to use in place of TRUE and FALSE. Most famously:

devtools::install_github("nutterb/sillylogic")
library(sillylogic)
x <- data.frame(letter = letters[1:10],
                stringsAsFactors = HELLNO)

Which ensures that strings are not converted to factors when the data frame is assigned.

class(x$letter)
## [1] "character"

Available Logical Representations

TRUE FALSE
COUNTMEIN ASIF
HELLYES HELLNO
WHYNOT NO
YES NOTHANKS
YESPLEASE NOWAY

And for those who like to live a little dangerously, feel free to use the surprise_me function.

set.seed(2)
x <- data.frame(letter = letters[1:10],
                stringsAsFactors = surprise_me())
class(x$letter)
## [1] "factor"
y <- data.frame(letter = letters[1:10],
                stringsAsFactors = surprise_me())
class(y$letter)
## [1] "character"