Learn R Programming

chatAI4R (version 0.3.6)

createRfunction: 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
)

Value

This function returns the generated R code as a clipboard content if SelectedCode is 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.

Author

Satoshi Kume

Details

Create R Function from Selected Text or Clipboard Content

Examples

Run this code
if (FALSE) {

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

Run the code above in your browser using DataLab