The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
rtern
brings a conditional ternary
operator using ?
and :
to R.
This groundbreaking spoonful of syntactic sugar will supercharge your workflow and see you bubble to the top of Kaggle leaderboards.
Yes, we know that it is possible to perform conditional assignment in base R multiple ways:
# Using a one-line if/else:
<- if (y > 1) 1 else 2
x # vectorized form:
<- ifelse(y > 1, 1, 2) x
However we’re sure you’ll agree that once you can do the same using only…
<- y > 1 ? 1 : 2 x
…your models will converge faster, ROC AUC will approach 1 and Hadley Wickham will be starring your repos.
The only downsides are that your linter won’t like it and that
this masks the base functionality of .?
in R
As of v0.1 help files can still be accessed by the ?
operator whilst rtern
is attached!
Who needs help files? Not you, champ.
rtern
is a lighthearted project for practicing package
development and nonstandard evaluation in R. The ?
operator
implementation borrows heavily from this Stack Exchange
answer.
You can install the latest released version of rtern from CRAN with:
install.packages("rtern")
Or install the development version from GitHub with:
# install.packages("devtools")
::install_github("grddavies/rtern") devtools
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.