autocreateFunction4R {chatAI4R}R Documentation

autocreateFunction4R (development / experimental)

Description

This function generates an R function based on a given description, proposes improvements, and then generates an improved version of the function. It is expected to use an AI model (possibly GPT-3 or similar) to perform these tasks. This is an experimental function.

Usage

autocreateFunction4R(
  Func_description,
  packages = "base",
  max_tokens = 250,
  View = TRUE,
  roxygen = TRUE,
  api_key = Sys.getenv("OPENAI_API_KEY"),
  verbose = TRUE
)

Arguments

Func_description

A character string that describes the function to be generated.

packages

A character string that specifies the packages to be used in the function. Default is "base".

max_tokens

An integer that specifies the maximum number of tokens to be returned by the AI model. Default is 250.

View

A logical that indicates whether to view the intermediate steps. Default is TRUE.

roxygen

A logical that indicates whether to include roxygen comments in the generated function. Default is TRUE.

api_key

A character string that represents the API key for the AI model being used. Default is the "OPENAI_API_KEY" environment variable.

verbose

A logical flag to print the message Default is TRUE.

Details

Generate and Improve R Functions

Value

The function returns a character string that represents the generated and improved R function.

Author(s)

Satoshi Kume

Examples

## Not run: 
  Sys.setenv(OPENAI_API_KEY = "<APIKEY>")
  autocreateFunction4R(Func_description = "2*n+3 sequence")

## End(Not run)

[Package chatAI4R version 0.2.10 Index]