Description
The chatgpt package is an R package that brings a ChatGPT coding assistant into RStudio. It is on CRAN and works through RStudio addins. You can open an interactive chat with ChatGPT, or select code and ask it to comment, complete, explain, refactor or optimize that code. Other addins create testthat unit tests, suggest a variable name for the result of some code, document a function in roxygen2 format, or find issues in the selected code. When no code is selected, the addin uses the whole file. To use it, you need an OpenAI API key, which you can set for the current session or keep in your .Renviron file. The README says quota errors from OpenAI have to be fixed on your account's billing details. The development version can be installed from GitHub. The source is public.…
Highlights
- Ask ChatGPT in an interactive RStudio chat
- Comment, complete, explain and refactor selected code
- Create testthat unit tests and roxygen2 docs
- Find issues and optimize selected code
- Uses the whole file when no code is selected
Ratings & Reviews
No ratings yet
Be the first to rate Chatgpt.
People also visit

ClaudeR - RStudio MCP Server
Connect RStudio to Claude Code, Codex, Gemini, and other LLM agents via MCP
Chatgpt FAQ
What is this package for?
It is an R package that adds ChatGPT-based coding help to RStudio through a set of addins.
How do I install it?
Install the released version from CRAN, or install the development version from GitHub. The README gives the commands.
Do I need an API key?
Yes. You need an OpenAI API key, which you set in R for the session, or in your .Renviron file with usethis::edit_r_environ().
Why do I get a quota error?
The README says the OpenAI account has run out of quota, and that you need to add billing details to fix it.
Which addins are included?
Ask ChatGPT, comment selected code, complete selected code, create unit tests, create a variable name, document code in roxygen2 format, explain code, find issues, optimize and refactor.
What are the best Chatgpt alternatives?
Popular alternatives to Chatgpt include Gptstudio, aider and Gpttools. See all Chatgpt alternatives


