How to Download & Install RStudio in Anaconda [Windows/Mac] (2023)

What is R?

R is a programming language. To use R, we need to install an Integrated Development Environment (IDE). Rstudio is the Best IDE available as it is user-friendly, open-source and is part of the Anaconda platform.

In this tutorial, we will learn

  • How to Install RStudio in Anaconda
  • Mac User
  • Widows User
  • How to Install R
  • Install R on Mac
  • Install R on Windows
  • How To Install Rstudio
  • Mac User
  • Windows User
  • Run RStudio
  • Test
  • Install package
  • Open a library
  • Run R code

What is Anaconda?

Anaconda free open source is distributing both Python and R programming language. Anaconda is widely used in the scientific community and data scientist to carry out Machine Learning project or data analysis.

Why use Anaconda?

Anaconda will help you to manage all the libraries required for Python in RStudio, or R. Anaconda will install all the required libraries and IDE into one single folder to simplify package management. Otherwise, you would need to install them separately.

How to Install RStudio in Anaconda

How to Download & Install RStudio in Anaconda [Windows/Mac] (1)

Installing RStudio in Anaconda

How to Install RStudio in Anaconda for Mac

Below are the steps to install RStudio in Anaconda for Mac:

Step 1) Download Anaconda for Python 3.6 for your OS.

Go to https://www.anaconda.com/download/ and download Anaconda

By default, Chrome selects the downloading page of your system. In this tutorial, Anaconda install RStudio is done for Mac. If you run on Windows or Linux, download Anaconda 5.1 for Windows installer or Anaconda 5.1 for Linux installer.

How to Download & Install RStudio in Anaconda [Windows/Mac] (2)

Step 2) Start Anaconda RStudio installation

You are now ready to install Anaconda RStudio. Double-click on the downloaded file to begin the installation. It is .dmg for mac and .exe for windows.You will be asked to confirm the installation. Click Continue button.

How to Download & Install RStudio in Anaconda [Windows/Mac] (3)

You are redirected to the Anaconda3 Installer.

How to Download & Install RStudio in Anaconda [Windows/Mac] (4)

Step 3) Continue with installation process

Next window displays the ReadMe. After you are done reading the document, click Continue

How to Download & Install RStudio in Anaconda [Windows/Mac] (5)

Step 4) Read the End User Agreement

This window shows the RStudio Anaconda End User License Agreement. Click Continue to agree.

How to Download & Install RStudio in Anaconda [Windows/Mac] (6)

Step 5) Click on the Agree button

You are prompted to agree, click Agree to go to the next step.

How to Download & Install RStudio in Anaconda [Windows/Mac] (7)

(Video) 1. Anaconda and RStudio Installation

Step 6) Locate the installation path

Click Change Install Location to set the location of Anaconda. By default, Anaconda is installed in the user environment: Users/YOURNAME/.

How to Download & Install RStudio in Anaconda [Windows/Mac] (8)

Select the destination by clicking on Install for me only. It means Anaconda will be accessible only to this user.

How to Download & Install RStudio in Anaconda [Windows/Mac] (9)

Step 7) Start installing Anaconda

You can install Conda in R now. Click Install to proceed. Anaconda takes around 2.5 GB on your hard drive.

How to Download & Install RStudio in Anaconda [Windows/Mac] (10)

A message box is prompt. You need to confirm by typing your password. Hit Install Software

How to Download & Install RStudio in Anaconda [Windows/Mac] (11)

It may take some time to Install Conda in R. It depends on your machine.

How to Download & Install RStudio in Anaconda [Windows/Mac] (12)

Step 8) Install VS Code if you want

Anaconda asks you if you want to install Microsoft VSCode. You can ignore it and hit Continue

How to Download & Install RStudio in Anaconda [Windows/Mac] (13)

Step 9) Finish the installation

The installation is completed. You can close the window.

How to Download & Install RStudio in Anaconda [Windows/Mac] (14)

You are asked if you want to move “Anaconda3” installer to the Trash. Click Move to Trash

How to Download & Install RStudio in Anaconda [Windows/Mac] (15)

You are done with the installation of Anaconda on a macOS system.

How to Install RStudio in Anaconda for Windows

Here are the steps to install RStudio in Anaconda for Windows:

Step 1) Open the downloaded exe and click Next

How to Download & Install RStudio in Anaconda [Windows/Mac] (16)

Step 2) Accept the License Agreement

(Video) How to install & setup R environment for RStudio in anaconda on windows 10.

How to Download & Install RStudio in Anaconda [Windows/Mac] (17)

Step 3) Select Just Me and click Next

How to Download & Install RStudio in Anaconda [Windows/Mac] (18)

Step 4) Select Destination Folder and Click Next

How to Download & Install RStudio in Anaconda [Windows/Mac] (19)

Step 5) Click Install in next Screen

How to Download & Install RStudio in Anaconda [Windows/Mac] (20)

Step 6) Installation will begin

How to Download & Install RStudio in Anaconda [Windows/Mac] (21)

Once done, Anaconda will be installed.

How to Install R

Install R on Mac

Here is a step by step process to install R on Mac:

Step 1) Anaconda uses the terminal to install libraries. The terminal is a quick way to install libraries. We need to be sure to point the installation toward the right path. In our case, we set the location of Anaconda to the Users/USERNAME/. We can confirm this by checking anaconda3 folder.

Open Computer and select Users, USERNAME and anaconda3. It confirms that we installed Anaconda on the right path. Now, let’s see how macOS write the path. Right-click, and then Get Info

How to Download & Install RStudio in Anaconda [Windows/Mac] (22)

Select the path Where and click Copy

How to Download & Install RStudio in Anaconda [Windows/Mac] (23)

Step 2) For Mac user:

  • The shortest way is to use the Spotlight Search and write terminal.

How to Download & Install RStudio in Anaconda [Windows/Mac] (24)

The terminal sets the default working directory to Users/USERNAME. As you can see in the figure below, the path of anaconda3 and the working directory are identical. In macOS, the latest folder is shown before the $. For me, it is Thomas. The terminal will install all the libraries in this working directory.

If the path on the text editor does not match the working directory, you can change it by writing cd PATH in the terminal. PATH is the path you pasted in the text editor. Don’t forget to wrap the PATH with “PATH”. This action will change the working directory to PATH.

How to Download & Install RStudio in Anaconda [Windows/Mac] (25)

Step 4) We are ready to install R. I recommend you to install all packages and dependencies with the conda command in the terminal.

## In the terminalconda install r-essentials --yes

r-essentials means conda will install R and all the necessary libraries used by data scientist.

How to Download & Install RStudio in Anaconda [Windows/Mac] (26)

Conda is downloading the libraries

(Video) How to Install R and Rstudio in Anaconda

It takes some time to upload all the libraries. Be patient…you are all set.

How to Download & Install RStudio in Anaconda [Windows/Mac] (27)

In the terminal, you should see Executing transaction: done. If so, you have successfully installed R.

You can check where R is located.

How to Download & Install RStudio in Anaconda [Windows/Mac] (28)

Install R on Windows

Following is a step by step process to install R on Windows:

Step 1) Open the Anaconda command prompt

How to Download & Install RStudio in Anaconda [Windows/Mac] (29)

Step 2) In the command prompt

  1. Enter the R install command
  2. Environment will be determined
  3. List of packages to be installed will be listed

How to Download & Install RStudio in Anaconda [Windows/Mac] (30)

Step 3) Enter y and hit the return key to start installation

How to Download & Install RStudio in Anaconda [Windows/Mac] (31)

Step 4) Installation will take time, and you will get done message.

How to Download & Install RStudio in Anaconda [Windows/Mac] (32)

How to Install RStudio

Mac User

In the terminal, write the following code to install RStudio Anaconda:

## In the terminalconda install -c r rstudio --yes

How to Download & Install RStudio in Anaconda [Windows/Mac] (33)

In the terminal, you should see Executing transaction: done. If so, you have successfully installed Rstudio.

You are all set now, congratulation!

Windows User

Step 1) Enter command to install RStudio on Anaconda prompt

How to Download & Install RStudio in Anaconda [Windows/Mac] (34)

Step 2) You will be shown a list of packages that will be installed. Enter y

How to Download & Install RStudio in Anaconda [Windows/Mac] (35)

Step 3) R Studio will be installed

How to Download & Install RStudio in Anaconda [Windows/Mac] (36)

Warning

Avoid as much as you can to install RStudio Anaconda library using pip for Python, and R. Conda libraries gather a lot of packages, you don’t need to install RStudio on Anaconda prompt libraries outside of conda environment.

(Video) Installation of RStudio for launching in Anaconda Navigator

Run Rstudio

Directly run the command line from the terminal to open Rstudio. You open the terminal and write rstudio. You can also use Desktop Shortcut

How to Download & Install RStudio in Anaconda [Windows/Mac] (37)

Or

How to Download & Install RStudio in Anaconda [Windows/Mac] (38)

A new window will be opened with Rstudio.

How to Download & Install RStudio in Anaconda [Windows/Mac] (39)

Test

Open Rstudio from the terminal and open a script. Write the following command:

  1. ## In Rstudio summary(cars)
  2. Click Run
  3. Check Output

How to Download & Install RStudio in Anaconda [Windows/Mac] (40)

If you can see the summary statistics, it works. You can close Rstudio without saving the files.

Install package

Install package with anaconda is trivial. You go to your favorite browser, type the name of the library followed by anaconda r.

How to Download & Install RStudio in Anaconda [Windows/Mac] (41)

You choose the link that points to anaconda. You copy and paste the library into the terminal.

How to Download & Install RStudio in Anaconda [Windows/Mac] (42)

For instance, we need to install randomForest for the tutorial on random forest; we go https://anaconda.org/r/r-randomforest.

How to Download & Install RStudio in Anaconda [Windows/Mac] (43)

Run conda install -c r r-randomforest –yes from the terminal.

How to Download & Install RStudio in Anaconda [Windows/Mac] (44)

The installation is completed.

Note that Thorough this tutorial, you won’t need to install many libraries as the most used libraries came with the r-essential conda library. It includes ggplot for the graph and caret for the machine learning project.

Open a library

To run the R function randomForest(), we need to open the library containing the function. In the Rstudio script, we can write library(randomForest)

## In Rstudiolibrary(randomForest)## randomForest 4.6-12## Type rfNews() to see new features/changes/bug fixes.

Warning: Avoid as much as possible to open unnecessary packages. You might ended up creating conflicts between libraries.

Run R code

We have two ways to run codes in R

  1. We can run the codes inside the Console. Our data will be stored in the Global Environment but no history is recorded. We won’t be able to replicate the results once R is closed. We need to write the codes all over again. This method is not recommended if we want to replicate our save our codes

How to Download & Install RStudio in Anaconda [Windows/Mac] (45)

  1. Write the code in the script. We can write as many lines of codes as we want. To run the code, we simple select the rows we want to return. Finally, click on run. We can see the output in the Console. We can save our script and open it later. Our results won’t we lost.

How to Download & Install RStudio in Anaconda [Windows/Mac] (46)

Warning: In we point the cursor at the second row (i.e., slice_vector[1:5]), the Console displays an error. That’s, we didn’t run the line number 1.

How to Download & Install RStudio in Anaconda [Windows/Mac] (47)

Similarly, if we point the cursor to an empty row and click on run, R return an empty output.

(Video) How to Install R Studio in Anaconda Navigator | Windows 10 | (2020)

How to Download & Install RStudio in Anaconda [Windows/Mac] (48)

You Might Like:

  • Data Types in R with Example
  • R While Loop with Programming Examples
  • Histogram vs Bar Graph – Difference Between Them

FAQs

How do I download R and RStudio on Mac? ›

Install R and R-Studio for Mac
  1. To install R, go to cran.r-project.org. ...
  2. Depending on your operating system, click Download R for your operating system.
  3. Click on R-3.6.1.pkg to install R.
  4. Once the file download is complete, click to open the installer. ...
  5. Once the R installer has finished, click Close.
  6. Next, download RStudio.
21 Jun 2022

How do I download R and RStudio on Windows? ›

Installing RStudio Desktop
  1. Go to the RStudio website.
  2. Click on "DOWNLOAD" in the top-right corner.
  3. Click on "DOWNLOAD" under the "RStudio Open Source License".
  4. Download RStudio Desktop recommended for your computer.
  5. Run the RStudio Executable file (.exe) for Windows OS or the Apple Image Disk file (. dmg) for macOS X.
7 Feb 2022

How long does Anaconda take to install RStudio? ›

While it is mostly unattended, the download and installation of Anaconda can take a fair amount of time (approximately 10 to 15 minutes, depending on the speed of your system), so it is highly recommended to do this before you arrive at the tutorial session (and when you have access to a decent internet connection).

Can I install R in Anaconda? ›

With Anaconda, you can easily install the R programming language and over 6,000 commonly used R packages for data science. You can also create and share your own custom R packages. When using conda to install R packages, you will need to add r- before the regular package name.

How do I run an R code in Anaconda? ›

Steps to Add R to Jupyter Notebook
  1. Step 1: Open the Anaconda Prompt. To start, open the Anaconda Prompt. ...
  2. Step 2: Add R to Jupyter. Next, type/copy the following command in order to add R to Jupyter: conda install -c r r-irkernel. ...
  3. Step 3: Launch Jupyter Notebook. ...
  4. Step 4: Create a new Notebook. ...
  5. Step 5: Run your Code.
25 Feb 2022

Do I need to download R before RStudio? ›

Regardless of your operating system, you should install R before installing RStudio.

Is RStudio compatible with Mac? ›

RStudio is available in open source and commercial editions and runs on the desktop (Windows, Mac, and Linux) or in a browser connected to RStudio Server or RStudio Workbench (Debian/Ubuntu, Red Hat/CentOS, and SUSE Linux).

How do I install RStudio packages? ›

Installing Packages
  1. Open RStudio. ...
  2. In the lower-right pane of RStudio, select the Packages tab and the Install button.
  3. Type the name of the packages to be installed in the “Packages (separate multiple packages with a space or comma):” box. ...
  4. Press Install .

Why does Anaconda take so long to install? ›

NOTE: the installer we'll be downloading and installing is larger than the average file, because it contains Python, associated packages, a code editor, and some other toys. It may take 15-20 minutes in total to download and install when executing the commands.

How do I install R in Python? ›

Installing and Configuring Python with RStudio
  1. Step 1) Install a base version of Python. ...
  2. Step 2) Create a Python environment in your project. ...
  3. Step 3) Activate your Python environment. ...
  4. Step 4) Install Python packages in your environment. ...
  5. Step 5) Install and configure reticulate to use your Python version.
16 Aug 2022

How do I install R? ›

How to download and install R and RStudio - YouTube

Which version of RStudio should I download? ›

RStudio requires an installation of R 3.0. 1 or higher. You can download the most recent version of R for your environment from CRAN.

How do I run an R program in Windows? ›

Running programs in the R Workspace
  1. Open R (Double Click on Desktop Icon or Open Program from START)
  2. Click on File → Open Script.
  3. Select the Program you want to run, it will appear in a R Editor Window.
  4. Right Click Select All (or Type Ctrl-A)
  5. Right Click Run Line or Selection (or Type Ctrl-R)

What is the difference between R and RStudio? ›

R the application is installed on your computer and uses your personal computer resources to process R programming language. RStudio integrates with R as an IDE (Integrated Development Environment) to provide further functionality. RStudio combines a source code editor, build automation tools and a debugger.

How do I install R in Python? ›

Installing and Configuring Python with RStudio
  1. Step 1) Install a base version of Python. ...
  2. Step 2) Create a Python environment in your project. ...
  3. Step 3) Activate your Python environment. ...
  4. Step 4) Install Python packages in your environment. ...
  5. Step 5) Install and configure reticulate to use your Python version.
16 Aug 2022

How do I launch Anaconda in RStudio? ›

Running RStudio

With the new environment active, navigate to the Home page. Click Install on the RStudio application tile. Once RStudio is installed, click Launch to run RStudio from Navigator.

How do I install R? ›

How to download and install R and RStudio - YouTube

How do I open RStudio from terminal? ›

1. Execute resource-heavy R code in the Terminal quickly
  1. Shift + Alt + R. Shift + Alt + R to open a new terminal.
  2. launch. R. in the Terminal.
  3. Ctrl + 1. to focus back to the editor window.
  4. Ctrl + Alt + Enter. Ctrl + Alt + Enter to send commands to be executed directly to the Terminal.
29 Sept 2018

Videos

1. Install, Configure and Run R & R packages on any Linux/Mac Machine using Anaconda
(Bioinformatics Coach)
2. Install R studio on Anaconda
(iq pop)
3. Setting R environment on Jupyter notebooks and R-studio in Anaconda environment.
(Shabbir Governor)
4. Reticulate Installation for Python in RStudio
(Leon Shpaner)
5. R Install WINDOWS
(Victor Planas-Bielsa)
6. Installing R packages in Anaconda R Environment via Anaconda IDE when install.packages fail
(Manoel Fernando Alonso Gadi)
Top Articles
Latest Posts
Article information

Author: Merrill Bechtelar CPA

Last Updated: 03/24/2023

Views: 5935

Rating: 5 / 5 (50 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Merrill Bechtelar CPA

Birthday: 1996-05-19

Address: Apt. 114 873 White Lodge, Libbyfurt, CA 93006

Phone: +5983010455207

Job: Legacy Representative

Hobby: Blacksmithing, Urban exploration, Sudoku, Slacklining, Creative writing, Community, Letterboxing

Introduction: My name is Merrill Bechtelar CPA, I am a clean, agreeable, glorious, magnificent, witty, enchanting, comfortable person who loves writing and wants to share my knowledge and understanding with you.