batman v0.1.0


Monthly downloads



Convert Categorical Representations of Logicals to Actual Logicals

Survey systems and other third-party data sources commonly use non-standard representations of logical values when it comes to qualitative data - "Yes", "No" and "N/A", say. batman is a package designed to seamlessly convert these into logicals. It is highly localised, and contains equivalents to boolean values in languages including German, French, Spanish, Italian, Turkish, Chinese and Polish.


NA N-A N/A Batman

batman is a package for taking representations of logical values commonly found in qualitative and categorical data, and mapping them to actual logical values.

In survey data and similar it's not uncommon to see logical values represented as things like:

  1. "Yes"
  2. "No"
  3. "N/A"

This is nice and all, but when you throw it into R...

> as.logical(c("Yes","No","N/A"))
[1] NA NA NA

batman maps common representations to actual logicals. It contains one core function, to_logical, designed to do just that:

> library(batman)
> to_logical(c("Yes","No", "N/A"))

The goal is to have it not only provide this functionality, but provide this functionality in an internationalised way - with support for as many languages as possible. If you're interested in contributing localised equivalents to TRUE or FALSE values, please open a GitHub isuse with your translations! You'll be credited in the DESCRIPTION file. See the contribution guidelines.

Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.


To get the release version:

> install.packages("batman")

To get the development version:

> library(devtools)
> install_github("ironholds/batman")


Other than base R, the only dependency is Rcpp, which we use for added speed when parsing strings (and it's worthwhile - the code can handle 700k strings in 137 milliseconds)

Functions in batman

Name Description
get_languages Get language codes for batman-supported languages
categorical_booleans TRUE/FALSE equivalents in categorical data for various languages
batman Convert categorical representations of logicals to actual logicals
to_logical Convert categorical representations of true/false values to a logical
No Results!

Last month downloads


Date 2015-10-13
License MIT + file LICENSE
Encoding UTF-8
LazyData true
LinkingTo Rcpp
NeedsCompilation yes
Packaged 2015-10-26 14:56:10 UTC; ironholds
Repository CRAN
Date/Publication 2015-10-26 17:07:24

Include our badge in your README