L1: R Studio

Bogdan G. Popescu

John Cabot University

What You’ll Learn Today

  • How to install R and RStudio
  • What Quarto is and how to use .qmd files
  • Basic R syntax and using R as a calculator
  • Understanding objects: numeric, character, and logical
  • Working with vectors, matrices, and data frames
  • Detecting missing values and using key functions like mean(), paste(), and sort()
  • How to write and structure clean, reproducible code in R

By the end, you’ll be able to write simple R scripts and explore your own data.

Installing R and R Studio

We will install two programs

  • R
  • R Studio

Installing R and R Studio

We can do that by going to: https://posit.co/download/rstudio-desktop/

Installing R Studio

We can do that by going to: https://posit.co/download/rstudio-desktop/

Install the version of RStudio relevant for your OS.

Note that there are different files for Apple silicon (M1/M2) Macs and for Intel Macs

Installing R Studio

We can do that by going to: https://posit.co/download/rstudio-desktop/

Install the version of RStudio relevant for your OS.

Note that there are different files for Apple silicon (M1/M2) Macs and for Intel Macs.

R panels

The platform interface for R studio looks like below:

R panels

The platform interface for R studio looks like below:

R panels

The platform interface for R studio looks like below:

R panels

The platform interface for R studio looks like below:

Quarto Files

Quarto is a version of R Markdown from RStudio that allows us to run code and write text.

Quarto files have the *.qmd extension

Quarto Files

You can produce a wide variety of output types:

  • executable code blocks
  • plots
  • tabular output from data frames
  • plain text output

Installation

You can now start typing.

To use Quarto with R, you should install the rmarkdown R package:

install.packages("rmarkdown")

Installation

You can now start typing.

To use Quarto with R, you should install the rmarkdown R package:

Installation

You can now start typing.

To use Quarto with R, you should install the rmarkdown R package:

Installation

You can now start typing.

To use Quarto with R, you should install the rmarkdown R package:

Using R

Let us now use R to understand how it works.

Let’s create a new quarto document and save it in your “week2” folder

Using R

Using R

Using R

Using R