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

View source: R/createRcode.R

createRcodeR Documentation

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
)

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.

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.

Value

Prints the generated R code to the R console.

RStudio Addins

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

Author(s)

Satoshi Kume

Examples

## Not run: 

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


## End(Not run)

chatAI4R documentation built on April 4, 2025, 1:06 a.m.