Title: | Translate R Code To An English Sentence |
---|---|
Description: | Take an R expression and convert it to English by matching recognised symbols with an opinionated list of English 'translations'. Inspired By Amelia McNamara's useR! 2020 conference talk. |
Authors: | Matt Dray [aut, cre], Chung-hong Chan [aut] |
Maintainer: | Matt Dray <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9006 |
Built: | 2024-11-24 04:09:55 UTC |
Source: | https://github.com/matt-dray/r2eng |
Print the highlighted R expression and English translation
addin_print()
addin_print()
Vocalise selected R expression aloud in English (macOS only).
addin_speak()
addin_speak()
This function evaluates the expression of the r2eng object.
evaluate(r2eng, ...) ## S3 method for class 'r2eng' evaluate(r2eng, envir = parent.frame(), ...)
evaluate(r2eng, ...) ## S3 method for class 'r2eng' evaluate(r2eng, envir = parent.frame(), ...)
r2eng |
An r2eng object to evaluate. |
... |
Other arguments to pass. |
envir |
Environment to evaluate the expression. Defaults to current environment. |
Nothing.
Print the r2eng object to see the original and translated expressions.
## S3 method for class 'r2eng' print(x, ...)
## S3 method for class 'r2eng' print(x, ...)
x |
An r2eng object to print. |
... |
Other arguments to pass. |
Nothing.
This function speaks the English expression of the r2eng object. Currently, only macOS is supported.
speak(r2eng, ...) ## S3 method for class 'r2eng' speak(r2eng, ...)
speak(r2eng, ...) ## S3 method for class 'r2eng' speak(r2eng, ...)
r2eng |
An r2eng object to speak. |
... |
Other arguments to pass. |
Nothing.
Takes an R expression and converts it to English by matching recognised symbols with an opinionated list of English 'translations'.
translate_string(expression, speak = TRUE, function_call_end = "of ") translate(expression, speak = TRUE, function_call_end = "of ")
translate_string(expression, speak = TRUE, function_call_end = "of ") translate(expression, speak = TRUE, function_call_end = "of ")
expression |
An R expression (bare if |
speak |
Logical. Do you want your system to try and say the English expression? macOS only. Requires speakers on your machine. |
function_call_end |
Character, what should be added after a function
call, e.g. setting this parameter to "of", this function translates
|
An r2eng object, which is a list with three elements: the input R expression, the 'translated' English expression and a data frame showing the translation of each R element.
## Not run: translate(variable <- 1) ## End(Not run)
## Not run: translate(variable <- 1) ## End(Not run)