Ergonomic tools for R.
At the console, run r devtools::install_github("D-Se/ergo")
ergo
?In natural language an important concept is usually easy to express. ergo
re-purposes the ?
operator and combines it with R's formula ~
interface to reduce glyphs needed.
| Base R | Tidyverse | Ergo |
|:-----------------------------------------:|-----------------------------------------------|:-------------------------------:|
| if(5 > 3) 10 else 5
| - | 5 > 3 ? 10 ~ 5
|
| ifelse(1:5 > 3, 10, 5)
| if_else(1:5 > 3, 10, 5)
| 1:5 > 3 ? 10 ~ 5
|
| ifelse(x>3, 5, ifelse(x>2, 10, 20))
| case_when(x>3 ~ 5, x>2 ~ 10, TRUE ~ 20)
| x>3 ? 5 ~ {x>2 ? 10 ~ 20}
|
| Base R | Ergo |
|:---------------------------:|:--------------------------:|
| is.numeric("5")
| "5" ? num
|
| Base R | Ergo |
|:---------------------------:|:--------------------------:|
| as.numeric("5")
| "5" ?~ num
|
| as.list(e, sorted = TRUE)
| e ?~ lst [sorted = TRUE]
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.