translate: Translate R Code To Spoken English

View source: R/translate.R

translate_stringR Documentation

Translate R Code To Spoken English

Description

Takes an R expression and converts it to English by matching recognised symbols with an opinionated list of English 'translations'.

Usage

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

## Not run: 
translate(variable <- 1)

## End(Not run)

matt-dray/r2eng documentation built on April 29, 2024, 5:24 p.m.