This is a demo.

# libs to import
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.6
## ✔ forcats   1.0.1     ✔ stringr   1.6.0
## ✔ ggplot2   4.0.1     ✔ tibble    3.3.0
## ✔ lubridate 1.9.4     ✔ tidyr     1.3.2
## ✔ purrr     1.2.0     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
# Performing experiments with penguins dataset

# Would usually use glimpse(), but in RStudio use View()
# View(penguins)
head(penguins) #first few lines
# Verify device is still active
dev.cur()
## quartz_off_screen 
##                 2
# Goal: find the correlation between body mass (g) and flipper length.

# Utilizing ggplot() for blank graph (canvas)
# mapping argument -> always defined in aes() function
# aes() function specify which variables to map to x & y axes

ggplot(data = penguins, mapping = aes(x = flipper_len, y = body_mass))

Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Cmd+Option+I.

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Cmd+Shift+K to preview the HTML file).

The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.

You can also embed plots, for example: