L3-Quarto

Autore/Autrice

GL

Data di Pubblicazione

24 luglio 2025

Let’s talk about rocks

See this specific code
```{r}
#| eval: false
print(rock)
```
Look at me!
summary(rock)
      area            peri            shape              perm        
 Min.   : 1016   Min.   : 308.6   Min.   :0.09033   Min.   :   6.30  
 1st Qu.: 5305   1st Qu.:1414.9   1st Qu.:0.16226   1st Qu.:  76.45  
 Median : 7487   Median :2536.2   Median :0.19886   Median : 130.50  
 Mean   : 7188   Mean   :2682.2   Mean   :0.21811   Mean   : 415.45  
 3rd Qu.: 8870   3rd Qu.:3989.5   3rd Qu.:0.26267   3rd Qu.: 777.50  
 Max.   :12212   Max.   :4864.2   Max.   :0.46413   Max.   :1300.00  

And now about anxiety and other stuff

'data.frame':   300 obs. of  4 variables:
 $ anxiety    : num  50.2 31.5 34 37.1 48.3 ...
 $ flexibility: num  44.4 47.7 65.6 50.7 51.3 ...
 $ mindfulness: chr  "no" "yes" "no" "no" ...
 $ activity   : chr  "pilates" "altro" "pilates" "altro" ...
Look at me!
summary(data)
    anxiety        flexibility    mindfulness          activity        
 Min.   : 1.483   Min.   :26.91   Length:300         Length:300        
 1st Qu.:25.977   1st Qu.:44.24   Class :character   Class :character  
 Median :33.922   Median :49.56   Mode  :character   Mode  :character  
 Mean   :33.418   Mean   :50.34                                        
 3rd Qu.:41.974   3rd Qu.:56.32                                        
 Max.   :64.775   Max.   :82.41                                        

Figura 1 illustrates a baby wearing a nirs cap with frontal probes.

look how I’ve imported this nice pic! ;)
knitr::include_graphics("img/bb.png")
Figura 1: A baby with a nirs cap

Figura 2 illustrates a plot

look how we directly plotted in Quarto (of course I copied Ottavia’s code)
ggplot(mtcars, aes(hp, mpg, color = factor(am))) +
  geom_point() +
  geom_smooth(formula = y ~ x, method = "loess") +
  theme(legend.position = 'bottom')
Figura 2: A graph from mtcars

Tabella 1 show the summary of the ChickWeight dataset

weight Time Chick Diet
Min. : 35.0 Min. : 0.00 13 : 12 1:220
1st Qu.: 63.0 1st Qu.: 4.00 9 : 12 2:120
Median :103.0 Median :10.00 20 : 12 3:120
Mean :121.8 Mean :10.72 10 : 12 4:118
3rd Qu.:163.8 3rd Qu.:16.00 17 : 12 NA
Max. :373.0 Max. :21.00 19 : 12 NA
NA NA (Other):506 NA
Tabella 1: ChickWeight data summary
Lista 1: Code use to generate the previous table
kable(summary(ChickWeight)) %>%
  scroll_box(height = "200px", width = "100%")

If you write “#| eval: false” in the previous code ref, quarto won’t return a table twice

'data.frame':   300 obs. of  4 variables:
 $ anxiety    : num  50.2 31.5 34 37.1 48.3 ...
 $ flexibility: num  44.4 47.7 65.6 50.7 51.3 ...
 $ mindfulness: chr  "no" "yes" "no" "no" ...
 $ activity   : chr  "pilates" "altro" "pilates" "altro" ...
anxiety flexibility mindfulness activity
Min. : 1.483 Min. :26.91 Length:300 Length:300
1st Qu.:25.977 1st Qu.:44.24 Class :character Class :character
Median :33.922 Median :49.56 Mode :character Mode :character
Mean :33.418 Mean :50.34 NA NA
3rd Qu.:41.974 3rd Qu.:56.32 NA NA
Max. :64.775 Max. :82.41 NA NA
Tabella 2: Data Summary
See this specific code
ggplot(data, 
       aes(anxiety, flexibility, color = factor(mindfulness))) +
  geom_point() +
  theme(legend.position = 'bottom')

See this specific code
ggplot(data,
       aes(anxiety, flexibility, color = factor(mindfulness))) + 
  geom_point() + 
  theme(legend.position = 'bottom') 

See this specific code
kable(summary(data)) 
anxiety flexibility mindfulness activity
Min. : 1.483 Min. :26.91 Length:300 Length:300
1st Qu.:25.977 1st Qu.:44.24 Class :character Class :character
Median :33.922 Median :49.56 Mode :character Mode :character
Mean :33.418 Mean :50.34 NA NA
3rd Qu.:41.974 3rd Qu.:56.32 NA NA
Max. :64.775 Max. :82.41 NA NA
See this specific code
ggplot(data,
       aes(anxiety, flexibility, color = factor(mindfulness))) +
  geom_point() +
  theme(legend.position = 'bottom')
1
specify the dataset
2
specify variables
3
select the type of point
4
select the legend position

Figura 3 illustrates different things. Figura 3 (a) and Figura 3 (c) illustrates Mindfulness aggregation, Figura 3 (b) and Figura 3 (d) illustrates Activity aggregation

See this specific code
ggplot(data, 
       aes(anxiety, flexibility, color = factor(mindfulness))) +
  geom_point()

ggplot(data, 
       aes(anxiety, flexibility, color = factor(activity))) +
  geom_point()

ggplot(data, 
       aes(anxiety, flexibility, shape = factor(mindfulness))) +
  geom_point()

ggplot(data, 
       aes(anxiety, flexibility, shape = factor(activity))) +
  geom_point()
(a) Mindfulness a
(b) Activity a
(c) Mindfulness b
(d) Activity b
Figura 3: One dataset, different graphical representations
See this specific code
kable(head(data))
kable(summary(data))
Tabella 3: Datasets
(a) Data
anxiety flexibility mindfulness activity
50.17244 44.39524 no pilates
31.47451 47.69823 yes altro
34.03981 65.58708 no pilates
37.06712 50.70508 no altro
48.30549 51.29288 no altro
16.94087 67.15065 yes altro
(b) DataSummary
anxiety flexibility mindfulness activity
Min. : 1.483 Min. :26.91 Length:300 Length:300
1st Qu.:25.977 1st Qu.:44.24 Class :character Class :character
Median :33.922 Median :49.56 Mode :character Mode :character
Mean :33.418 Mean :50.34 NA NA
3rd Qu.:41.974 3rd Qu.:56.32 NA NA
Max. :64.775 Max. :82.41 NA NA

The mean of the anxiety variable is 33.4179293