ironholds / batman Goto Github PK
View Code? Open in Web Editor NEWConvert categorical representations of logicals to actual logicals
License: Other
Convert categorical representations of logicals to actual logicals
License: Other
Dear Oliver,
Based on your suggestion, I am adding the following as a potential suggestion for generalizing batman:
The other common interchangeable things you see on surveys are integers written in english: 1 as "one", 2 as "two" etc.
I believe we can exploit venables english package to easily support english lang.
This is much faster. Good GOD did I overengineer this package.
Not sure if this nice little package is still maintained. This is a feature request.
Currently, to_logical does not accept anything else than character vectors. That's really limiting.
A very frequent use case would be to be able to pass this function in for example dplyr::mutate on a set of columns selected with tidy select, even if this should sometimes capture other columns than characters - instead of resulting in an error, it would be good if just the same vector would be returned and maybe a warning instead.
library(batman)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
foo0 <- foo1 <- data.frame(cat1 = c("Y", "N"))
foo1 <- data.frame(cat1 = c("Y", "N"), cat2 = c(T, F))
foo2 <- data.frame(cat1 = c("Y", "N"), cat2 = c(T, F), cat3 = 0:1)
mutate(foo0,across(everything(), to_logical))
#> cat1
#> 1 TRUE
#> 2 FALSE
mutate(foo1,across(everything(), to_logical))
#> Error: Problem with `mutate()` input `..1`.
#> x Expecting a string vector: [type=logical; required=STRSXP].
#> ℹ Input `..1` is `(function (.cols = everything(), .fns = NULL, ..., .names = NULL) ...`.
mutate(foo2,across(everything(), to_logical))
#> Error: Problem with `mutate()` input `..1`.
#> x Expecting a string vector: [type=logical; required=STRSXP].
#> ℹ Input `..1` is `(function (.cols = everything(), .fns = NULL, ..., .names = NULL) ...`.
Created on 2021-03-21 by the reprex package (v1.0.0)
Great idea! How about multilingual support, either as a function argument or in response to the language environment?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.