View source: R/convertRscript2Function.R
convertRscript2Function | R Documentation |
Convert selected R script to an R function using LLM.
convertRscript2Function(
Model = "gpt-4o-mini",
SelectedCode = TRUE,
verbose = TRUE
)
Model |
The OpenAI GPT model to use for text generation. Default is "gpt-4o-mini". |
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. |
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.
Inserts the converted function into the RStudio editor if 'SelectedCode' is TRUE, otherwise writes to clipboard.
Satoshi Kume
## Not run:
# Option 1
# Select some text in RStudio and then run the rstudio addins
# Option 2
# Copy the text into your clipboard then execute
convertRscript2Function(Model = "gpt-4o-mini", SelectedCode = F)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.