Installing R & RStudio | Dataplexa

Installing R & RStudio

Before writing any R programs, we need to prepare our system properly. In this lesson, you will learn how to install R and RStudio step by step using official sources.

Take your time with this lesson. A correct setup will make all future lessons smooth and error-free.


What is R?

R is the programming language that performs calculations, data analysis, and statistical operations. It is the core engine that runs every R command you write.

Without installing R, no R program can execute on your system.


What is RStudio?

RStudio is a user-friendly application that helps you write, run, and manage R code easily. It provides a clean interface for beginners and professionals.

RStudio does not replace R. It works on top of R and connects to the R language installed on your computer.


Why Do We Need Both R and RStudio?

Many beginners assume RStudio alone is enough, but this is incorrect. You must install R first.

  • R → Executes your code
  • RStudio → Helps you write and manage code

Together, they form a complete R programming environment.


Step 1: Download and Install R

Always download R from its official website to avoid errors and security issues.

Open the official R download page:

https://cran.r-project.org/

On the page, choose your operating system:

  • Click Download R for Windows if you use Windows
  • Click Download R for macOS if you use a Mac
  • Click Download R for Linux if you use Linux

After downloading:

  • Open the installer
  • Click Next on all screens
  • Keep default settings
  • Finish the installation

For beginners, default settings are recommended.


Step 2: Verify R Installation

After installation, confirm that R is installed correctly.

  • Search for R on your computer
  • Open the R application
  • Check if the R console opens without errors

If the console opens successfully, R is installed correctly.


Step 3: Download and Install RStudio

Now that R is installed, you can install RStudio.

Open the official RStudio download page:

https://posit.co/download/rstudio-desktop/

Steps to install RStudio:

  • Scroll to the Desktop section
  • Download the free version
  • Select your operating system
  • Run the installer
  • Follow default installation steps

No paid version is required for learning R.


Step 4: Open RStudio

After installation, open RStudio from your applications.

If RStudio opens without showing errors, it means it has successfully connected to R.

This confirms your setup is complete.


Understanding the RStudio Interface (Quick Overview)

When RStudio opens, you will see different sections on the screen.

  • Script Editor – where you write R code
  • Console – where code runs
  • Environment – shows data and variables
  • Files / Plots / Help – shows outputs and documentation

Do not worry if this looks confusing. Each section will be explained in upcoming lessons.


Test Your Installation

Let us run a simple command to confirm everything works correctly.

print("R and RStudio are installed correctly!")

If you see the message in the console, your setup is successful.


Common Beginner Mistakes

Avoid these common issues during installation:

  • Installing RStudio before installing R
  • Downloading R from unofficial websites
  • Closing the installer before completion
  • Ignoring error messages

If something goes wrong, uninstall and reinstall both R and RStudio.


What’s Next?

Now your system is ready for learning R programming.

In the next lesson, you will learn basic R syntax and how commands are written. This is where actual programming begins.