convertRscript2Function {chatAI4R}R Documentation

convertRscript2Function

Description

Convert selected R script to an R function using LLM.

Usage

convertRscript2Function(
  Model = "gpt-4-0613",
  SelectedCode = TRUE,
  verbose = TRUE
)

Arguments

Model

The OpenAI GPT model to use for text generation. Default is "gpt-4-0613".

SelectedCode

Logical flag to indicate whether to use selected code in RStudio. Default is TRUE.

verbose

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

Details

Convert Selected R Script to R Function

This function takes a selected portion of an R script and converts it into an R function. The function uses the OpenAI GPT model for text generation to assist in the conversion. The function can either take the selected code from the RStudio environment or from the clipboard.

Value

Inserts the converted function into the RStudio editor if 'SelectedCode' is TRUE, otherwise writes to clipboard.

Author(s)

Satoshi Kume

Examples

## Not run: 
convertRscript2Function(Model = "gpt-4-0613", SelectedCode = F)

## End(Not run)

[Package chatAI4R version 0.2.10 Index]