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 ")

Arguments

expression

An R expression (bare if translate(), quoted if translate_string()).

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 summary(x) to "summary of x open paren x close paren".

Value

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.

Examples

if (FALSE) {
translate(variable <- 1)
}