The goal of askgpt is to help you to learn R using a ChatGPT-like prompt and answer system. It wraps the openai package and let’s you ask question from the R Console directly.
You can install the development version of askgpt like so:
remotes::install_github("JBGruber/askgpt")
Then you should get a key for theopenai API on this page. Save it to your project with:
usethis::edit_r_environ(scope = "project")
In the format:
OPENAI_API_KEY = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
askgpt.webm
library(askgpt)
library(askgpt)
log_init() # run to enable error logging
askgpt("What is an R function?")
mean[1]
askgpt("What is wrong with my last command?") # this is a special trigger prompt that sends your last command to GPT
askgpt("Can you help me with the function aes() from ggplot2?")
askgpt("Can you elaborate on that?") # the api does not really have a memory, the last prompt is sent to the API again