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.
Step 1) Go to https://www.anaconda.com/download/ and Download Anaconda for Python 3.6 for your OS.
By default, Chrome selects the downloading page of your system. In this tutorial, installation 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.
Step 2) You are now ready to install Anaconda. 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.
You are redirected to the Anaconda3 Installer.
Step 3) Next window displays the ReadMe. After you are done reading the document, click Continue
Step 4) This window shows the Anaconda End User License Agreement. Click Continue to agree.
Step 5) You are prompted to agree, click Agree to go to the next step.
Step 6) Click Change Install Location to set the location of Anaconda. By default, Anaconda is installed in the user environment: Users/YOURNAME/.
Select the destination by clicking on Install for me only. It means Anaconda will be accessible only to this user.
Step 7) You can install Anaconda now. Click Install to proceed. Anaconda takes around 2.5 GB on your hard drive.A message box is prompt. You need to confirm by typing your password. Hit Install Software
Step 8) Anaconda asks you if you want to install Microsoft VSCode. You can ignore it and hit Continue
Step 9) The installation is completed. You can close the window.
You are asked if you want to move "Anaconda3" installer to the Trash. Click Move to Trash
You are done with the installation of Anaconda on a macOS system
Install R
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
Select the path Where and click Copy
Step 2) For Mac user:The shortest way is to use the Spotlight Search and write terminal.
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.
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.
Conda is downloading the libraries It takes some time to upload all the libraries. Be patient...you are all set.
In the terminal, you should see Executing transaction: done. If so, you have successfully installed R.
You can check where R is located.
Install Rstudio
In the terminal, write the following code:
## In the terminalconda install -c r rstudio --yes
In the terminal, you should see Executing transaction: done. If so, you have successfully installed Rstudio.