createRfunction: Create R Function from Selected Text or Clipboard Content and...

View source: R/createRfunction.R

createRfunctionR Documentation

Create R Function from Selected Text or Clipboard Content and Output into the R Console

Description

This function reads text either from your selected text in RStudio or from the clipboard, interprets it as a prompt, and generates an R function based on the given input. The generated R code is then printed into the source file or the R console with optional slow printing.

Usage

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

Arguments

Model

A character string representing the model to be used. Default is "gpt-4o-mini".

SelectedCode

A logical value indicating if the selected text should be used as input. Default is TRUE.

verbose

A logical value indicating if progress should be printed. Default is TRUE.

SlowTone

A logical value indicating if slow printing should be used. Default is FALSE.

Details

Create R Function from Selected Text or Clipboard Content

Value

This function returns the generated R code as a clipboard content if SelectedCode is FALSE.

Author(s)

Satoshi Kume

Examples

## Not run: 

#Copy the idea text of the R function to your clipboard and run this function.
createRfunction(SelectedCode = FALSE)

## End(Not run)

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