Package 'r2eng'

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

Help Index


RStudio Addin: Print Translated R Expression

Description

Print the highlighted R expression and English translation

Usage

addin_print()

RStudio Addin: Vocalise An R Expression

Description

Vocalise selected R expression aloud in English (macOS only).

Usage

addin_speak()

Evaluate expression in r2eng object

Description

This function evaluates the expression of the r2eng object.

Usage

evaluate(r2eng, ...)

## S3 method for class 'r2eng'
evaluate(r2eng, envir = parent.frame(), ...)

Arguments

r2eng

An r2eng object to evaluate.

...

Other arguments to pass.

envir

Environment to evaluate the expression. Defaults to current environment.

Value

Nothing.


Print r2eng Object For Reading

Description

Print the r2eng object to see the original and translated expressions.

Usage

## S3 method for class 'r2eng'
print(x, ...)

Arguments

x

An r2eng object to print.

...

Other arguments to pass.

Value

Nothing.


Speak out the English expression of r2eng object

Description

This function speaks the English expression of the r2eng object. Currently, only macOS is supported.

Usage

speak(r2eng, ...)

## S3 method for class 'r2eng'
speak(r2eng, ...)

Arguments

r2eng

An r2eng object to speak.

...

Other arguments to pass.

Value

Nothing.


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)