RStudio
For Rstudio we recommend using the 'Local Jobs' feature to run jobs in the background. This way you can submit multiple jobs whilst also making sure the job continues to run if you navigate away from Rstudio without blocking the interface.
Learn more about local jobs in Rstudio.
Recovering an unresponsive RStudio session
In certain cases RStudio sessions can become unresponsive, due to large amounts of output printed or large amount of data loaded. If restarting the application in Nuvolos doesn't resolve the issue, you can follow the steps in the Application Troubleshooting guide to clear the application state.
RStudio is responsive but it doesn't accept commands
If you can interact with the RStudio window (menu items are working, dropdowns open, etc.) but commands you try to run in R will not execute, it might be that the R console is showing a plus sign at the start of the line:

If this is the case, R is waiting for further input. As you can see in the above example, a curly brace was open, and R waits the curly brace to be closed for the expression to be complete (and executable).
If you want to cancel the statement, make sure to focus on the R console in RStudio by clicking on it, then hit the Escape button on your keyboard.

Configuring R Session and RStudio
Upon startup, R and RStudio look for several files to control the behavior of your R session, such as setting options, environment variables, or package repositories.
User and Project Level Configuration
.Rprofile
The .Rprofile file contains R code that is executed at the start of every R session. It's commonly used to set options (e.g., options(digits = 3)) or load frequently used packages.
Location: Can be in your home directory (
~/.Rprofile) for global settings or in your project's root directory for project-specific settings.Behavior: R only sources one
.Rprofilefile. If a project-level file exists, it will be used, and the user-level file will be ignored. To use both, you must explicitly source the user-level file at the top of your project-level.Rprofile:source("~/.Rprofile").Editing: You can use
usethis::edit_r_profile()to easily edit these files.
.Renviron
The .Renviron file is used to define environment variables. This is the preferred way to store credentials or API keys instead of hardcoding them in scripts.
Format: Variables are defined in a key-value format:
API_KEY=your_secret_key.Location: Like
.Rprofile, it can be at the user or project level. If a project-level file exists, the user-level one is ignored.Editing: Use
usethis::edit_r_environ()to edit.
System-Wide Configuration
Rprofile.site and Renviron.site
These are the system-wide equivalents of .Rprofile and .Renviron. They are specific to a particular version of R and are usually managed by administrators.
Location: They are located in the
R_HOME/etc/directory. You can findR_HOMEby runningR.home(component = "home")in R.Usage: Often used to set default package repositories for all users of that R version.
rsession.conf and repos.conf
In RStudio Workbench or RStudio Server, administrators can configure server-wide package repositories using these files.
rsession.conf: Used when only one repository is configured.repos.conf: Used when multiple repositories are needed.
Using Tensorflow and Keras with RStudio
Tensorflow and Keras can be installed via miniconda in Rstudio. To install them, use the following steps:
Restart the R session to be in a clean setting (select Session > Quit Session on the top menu)
Make sure reticulate can use miniconda via running in the R commands:
3. Install tensorflow R package and then call the install_tensorflow() function. If you would like to use GPU acceleration, run install_tensorflow(version="gpu"):
4. Install Keras R package and then call the install_keras() function:
To test the installation, follow the example from the RStudio website: https://tensorflow.rstudio.com/guide/keras/#mnist-example
GitHub Copilot with RStudio
Starting from RStudio app version R 4.3.2 with RStudio 2023.09, the GitHub Copilot integration is configurable in Global Options:
GitHub Copilot requires a GitHub account with an active GitHub Copilot subscription. It currently cannot make use of an OpenAI API key. For OpenAI API integration, see the ellmer package section below.

Using ellmer with OpenAI GPT-5.2 and other Large Language Models
The ellmer package provides a unified interface for interacting with large language models directly from R, including OpenAI's GPT-5.2. This allows you to leverage AI capabilities for code generation, data analysis assistance, and natural language processing tasks within your RStudio workflow.
Installation
Install the ellmer package from CRAN:
Configuration with OpenAI API
To use ellmer with OpenAI's GPT-5.2 model, you need to provide your API key.
You need an OpenAI API key from a paid OpenAI API account. A ChatGPT subscription is not sufficient - you must create an API key at platform.openai.com/api-keys.
We recommend storing your OpenAI API key as a Nuvolos secret, which will be automatically exposed as an environment variable in your application. See Environment Variables and Secrets for details on how to set up secrets.
Set up your OPENAI_API_KEY as a Nuvolos secret. Once configured, the secret will be available as an environment variable when your RStudio application starts, and ellmer will automatically detect it.
Using ellmer with GPT-5.2
Create a chat object to interact with the GPT-5.2 model:
You can also use ellmer for more advanced tasks:
Additional Configuration
You can customize the model's behavior with additional parameters:
For more information about ellmer, consult the package documentation by running ?ellmer in R or visiting the package's CRAN page.
Last updated
Was this helpful?