How to Setup RStudio for Data Visualization

How to Setup RStudio for Data Visualization

RStudio is the best integrated development environment (IDE) for data science teams that use the R programming language. It includes a syntax-highlighting editor and console alongside plotting, debugging, and workspace management tools. In addition, R Studio makes working with R easier by providing a much more friendly and robust GUI environment for working with R. In this article; I'll show you how to install the R programming language and R Studio on your most preferred operating system.

RStudio products catalog

Prerequisites

  • Background knowledge of R programming language.
  • A computer machine running Windows, Linux, or macOS operating system.
  • Ability to use the web browser and command-line interface.
  • A little smile? :)

R Installation Guide

To use RStudio, you need to install the R programming language first. R is a free software environment for statistical computing and graphics. Next, you have to choose your preferred CRAN (Comprehensive R Archive Network) mirror from the available options to download R. The Comprehensive R Archive Network (CRAN) is a network of FTP and web servers around the world that store identical, up-to-date versions of R and acts as the primary web service distributing R sources, binaries, extension packages, and documentation.

To save yourself some stress, you can choose the 0-Cloud option, as that will automatically redirect you to the best and closest server.

A screenshot of the CRAN mirrors page

Installing on Windows

Download the latest version of the base distribution of R here. This should download a file with the name R-4.1.1-win.exe (version name would change in the future) that will work on 32 and 64 bits. You can then run the installer file and install as you normally install .exe files. If you want, you can read the Windows installation guide for more instructions.

Installing on Linux

Download the latest version of R for Debian, Fedora, Redhat, Suse, and Ubuntu here. Alternatively, you can use the commands below to install from your terminal.

For Debian

apt-get update
apt-get install r-base r-base-dev

If you want, you can read the Debian installation guide for more instructions.

For Fedora

sudo dnf install R

If you want, you can read the Fedora installation guide for more instructions.

For Redhat

sudo dnf install R

If you want, you can read the Redhat installation guide for more instructions.

For Suse

VERSION=$(grep "^PRETTY_NAME" /etc/os-release | tr " " "_" | sed -e 's/PRETTY_NAME=//' | sed -e 's/"//g')
zypper addrepo -f http://download.opensuse.org/repositories/devel\:/languages\:/R\:/patched/$VERSION/ R-base
zypper install R-base R-base-devel

If you want, you can read the Suse installation guide for more instructions.

For Ubuntu

# update indices
apt update -qq

# install required helper packages
apt install --no-install-recommends software-properties-common dirmngr

# add the signing key
wget -qO- https://cloud.r-project.org/bin/linux/ubuntu/marutter_pubkey.asc | sudo tee -a /etc/apt/trusted.gpg.d/cran_ubuntu_key.asc

# add the R 4.0 repo from CRAN
add-apt-repository "deb https://cloud.r-project.org/bin/linux/ubuntu $(lsb_release -cs)-cran40/"
apt install --no-install-recommends r-base

If you want, you can read the Ubuntu installation guide for more instructions.

Installing on macOS

Download the latest version of the base distribution of R here. This should download a file with the name R-4.1.1.pkg (version name would change in the future). You can then run the installer file and install as you normally install .pkg files.

If you want, you can read the macOS installation guide for more instructions.

R Studio Installation Guide

There are two versions of RStudio; the RStudio Desktop (the desktop app) and RStudio Server (the server running on a web browser). Both have free and paid editions with several additional features, as seen in the screenshots taken from the R Studio official website below:

RStudio Desktop features

RStudio Server features

To download either of the versions, head to the download page and click on the "download" button for RStudio Desktop or RStudio Server. Alternatively, you can click on the "buy" button if you want to purchase the other editions. Once you click on "download," you will be redirected to the download page, which will automatically detect your operating system and recommend the file to download (this works only for RStudio Desktop. You can find the RStudio Server installation guide here). Below that, you will also find a list of other installers for different operating systems. So, pick what you want and download the file.

RStudio Desktop download page

Conclusion

Upon successful installation, you can now use RStudio Desktop to write your R programs whilst enjoying all the benefits of R Studio. As seen in the screenshot below from my setup, you'll get the editor at the left-corner, console, terminal, and jobs at the bottom-left-corner, environment at the right-corner, and plots/packages, at the bottom-right corner of the application window. Of course, you can customize the arrangement, change your theme, download R packages, and other settings as you deem fit.

RStudio Desktop demo

That's all for this tutorial, and I hope it was helpful. I'll be publishing an introductory guide to the R programming language for beginners soon, so ensure to subscribe to my newsletter to get updated. For RStudio product guides and helpful tutorials, you can check out the RStudio documentation page. Cheers! 💙

Attributions