R is the open-source programming language itself, and RStudio is the integrated development environment (IDE) That allows users to code with R and have easy access to tools, data, and visualizations. Learn to update R, RStudio, and packages.
You’re been working on a project in RStudio for days and are knee-deep in code and loaded libraries. Things are going great…until they aren’t anymore 🙄. Suddenly, the dreaded error messages pop up when you try to utilize a library you’ve been using effortlessly so far. You decide to ignore it for now and worry about it later. But the next time you open your RStudio session, another problem arises. It’s time to update your RStudio software. You reason with yourself and decide to take care of it now because you know all too well, these issues and indicators ONLY KEEP COMING 😱.
These problems can be scary and intimidating when you’re in the middle of a workflow, even for the most experienced programmers. For one, you have to disrupt the ‘’ that you have magically achieved. No one wants to stop what they’re doing so they can jump into troubleshooting mode.
Second, programming can be finicky and there are many moving pieces. Once you’ve found a working method, you just don’t want to mess with it. Updating your software leads to updating your libraries and it’s impossible to know if those updates may lead to bugs in your code.
Table of Contents:
What is R and RStudio?
Why you should keep your software updated.
How to check your current version of R and RStudio.
Sidetrack - Updating R packages.
How to update R.
How to update RStudio.
Troubleshooting.
R and RStudio - What’s the Difference?
R is the open-source programming language itself, and is the integrated development environment (IDE) that allows users to code with R and have easy access to tools, data, and visualizations in a tidy console-like environment. Unfortunately, you have to update them independently. Although, you can get away with only updating RStudio most of the time and leaving R alone.
Why You Should Stay up to Date
A common reaction to this scenario is to put off the updates and “think about it later”. That might work for a little while, but here’s why you should just deal with it right away and keep your software updated.
Benefit from the latest new features of RStudio.
Repair issues that you’re having.
Remedy underlying bugs that RStudio programmers have updated, even if they haven’t affected your workflow (yet).
Eliminate those pesky warning messages.
Maintain R and RStudio in a happy state of being together.
How To Check Your Current Version of R and RStudio
There are a few methods to check your current software version(s). It’s good to take note of the version(s) you are using now, just in case you run into any issues and decide you want to revert backward. This is unlikely, but you might as well be cautious.
RStudio - Method 1:
Mostly, you’ll see a pop-up window like the one below when you open RStudio. This tells you your current version and which version is available.
RStudio - Method 2:
If you’re not receiving these update indications, you can still check for updates manually. First, you navigate to the Help tab and select Check for Updates (highlighted in yellow below).
Clicking this will prompt the same window as before to pop up.
R - Method 1:
To check your current version of R, type sessionInfo() into the console (seen in blue font below). Running the command will yield the following results. The results show that R version 4.2.1 is currently in use.
R - Method 2:
Things are getting redundant now, but the easiest method to check your version of R (and the funniest) is to simply open RStudio, look to the console, and read the text displayed.You’ll notice the project team that developed this version gave it a humorous name. In this case, R version 4.2.1 is also known as “Funny-Looking-Kid” 😭 (highlighted in yellow below).
A Sidetrack
You might not be ready to update RStudio altogether, but you’re receiving error messages and bugs related to packages. Keep in mind you can try updating the troublesome package and see if that remedies the error. Navigate to your Packages tab where you can see a list of RStudio packages. Click the Update button (see image below).
After clicking Update on the Packages tab, a new window will appear like the image shown below. The new window informs you of the package version you have installed currently and which version is available to be installed.
You can also click on the NEWS button for the package of interest to see what has been updated. Clicking this button will open a browser with a list of information. For example, clicking ggplot2’s NEWS button reveals numerous changes and bug fixes in the new version (see the image below).
Updating Packages:
Method 1:Update Every Package
Click Select All at the bottom to select all packages.
Click Install Updates.
Method 2: Update Only Select Packages
Click the box next to the package(s) you wish to update.
Select Install Updates.
A warning prompt requesting to restart R will appear, click Yes.
After the update is complete, you will notice the changes listed in the console. Your package version should be updated within the list of packages.
How to Update R
If you’re planning on updating both R and RStudio, it’s more logical to update R first but you can update them in either order. If you’re only planning on updating RStudio, proceed to the next section.
Navigate to and look up the latest version of R. To download the latest version, you’ll have to choose your which is sorted regionally. CRAN is a network of servers that store the latest versions of R. They ask to choose the mirror “nearest to you to minimize network load”. Download and install the file.
Confirm that you have successfully installed the latest version and move on to updating RStudio. The image below shows that R has been updated to version 4.2.3 “Shortstop Beagle”.
How to Update RStudio
Now you know what version you are running, what next?
From the updater popup window, click on Quit and Download. This action will close your RStudio session and will open automatically in your browser.
Download the latest version, open the installation file, and you will be greeted with the RStudio Setup window. Next, you can select your Start Menu Folder, and which version of R you would like to use. If you have installed the latest R, select the specific version.
After updating, open a new session of RStudio and check for updates. You should see the following window.
Troubleshooting
Both R and RStudio should be updated now. But your console session in RStudio reads that you are still using the old version of R. What gives? You may have to do one last step to select the updated version of R.
In RStudio, under the Tools tab, select Global Options.
On the next window, under the R General section, select the correct directory for your updated R version by clicking the Change button.
On the next window that appears, select the updated version of R.
Finally, close your RStudio session, reopen it, and inspect the console. It should read the latest version of R installed. In my case, I am now using R 4.2.3 or “Shortstop Beagle”.
Final Thoughts
Now you have learned how to update R, RStudio, and your packages. Things should be smooth sailing now and you can get back into working in the zone.
Note: This tutorial was performed on a Windows computer.
Lead image source: stable diffusion v2.1 with prompt “Beagles playing baseball”.