Learn R Programming

chatAI4R (version 0.3.6)

createRcode: Create R Code from Clipboard Content and Output into the R Console

Description

Reads text from the clipboard and generates R code based on the given input, printing the result to the R console.

Usage

createRcode(
  Summary_nch = 100,
  Model = "gpt-4o-mini",
  SelectedCode = TRUE,
  verbose = TRUE,
  SlowTone = FALSE
)

Value

Prints the generated R code to the R console.

Arguments

Summary_nch

The maximum number of characters for the summary.

Model

The model to be used for code generation, default is "gpt-4o-mini".

SelectedCode

A logical flag to indicate whether to read from RStudio's selected text. Default is TRUE.

verbose

A logical value indicating whether to print the result to the console, default is TRUE.

SlowTone

A logical value indicating whether to print the result slowly, default is FALSE.

RStudio Addins

This function can be added to RStudio's Addins menu for easy access.

Author

Satoshi Kume

Details

Create R Code from Selected Text or Clipboard Content

This function reads text from your selected text or clipboard, interprets it as a prompt, and generates R code based on the given input. The generated R code is then printed to the R console with optional slow printing. This function can be executed from RStudio's Addins menu.

Examples

Run this code
if (FALSE) {

# Copy the origin of R code to your clipboard then execute from RStudio's Addins.

}

Run the code above in your browser using DataLab