r_gpt: R chatGPT copilot Function

View source: R/r_gpt.R

r_gptR Documentation

R chatGPT copilot Function

Description

This function allows the user to interact with the chat_gpt function in a more streamlined way and it is useful to obtain R code directly into the R session.

Usage

  r_gpt(prompt, prompt0 = NULL, verbose = TRUE, n = 1)

Arguments

prompt

A character string representing the request for the user to write a script.

prompt0

An optional character string representing the initial prompt for the user. If not provided, the default prompt will be used.

verbose

A logical value indicating whether the function should print messages to the console during execution. The default value is TRUE.

n

An integer value indicating the number of responses to return. The default value is 1.

Details

The r_gpt function is designed to help users with R programming tasks by prompting them to write scripts based on requests. The function uses the chat_gpt function to generate R code without explanations.

Value

The function returns the code generated by the chat_gpt function.

Examples

  # Use the r_gpt function to generate code for a request.
  r_gpt("Create a histogram of the 'mpg' variable in the 'mtcars' dataset.")

douve/UEMR documentation built on Aug. 28, 2023, 2:30 p.m.