RainCloud_plot

Quarto

Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.

Running Code

When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:

library(ggdist)
Warning: package 'ggdist' was built under R version 4.1.3
library(tidyverse)
Warning: package 'tidyverse' was built under R version 4.1.3
Warning: package 'tibble' was built under R version 4.1.3
Warning: package 'readr' was built under R version 4.1.3
Warning: package 'stringr' was built under R version 4.1.3
Warning: package 'forcats' was built under R version 4.1.3
Warning: package 'lubridate' was built under R version 4.1.3
-- Attaching core tidyverse packages ------------------------ tidyverse 2.0.0 --
v dplyr     1.1.4     v readr     2.1.4
v forcats   1.0.0     v stringr   1.5.0
v ggplot2   3.5.1     v tibble    3.2.1
v lubridate 1.9.2     v tidyr     1.1.4
v purrr     0.3.4     
-- Conflicts ------------------------------------------ tidyverse_conflicts() --
x dplyr::filter() masks stats::filter()
x dplyr::lag()    masks stats::lag()
i Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggplot2)

data <- read.csv("gym_members.csv")

# Converteix la variable categorica a factor si cal
data$Workout_Type <- as.factor(data$Workout_Type) # Per exemple, el tipus d'exercici

# Crear el Raincloud Plot
ggplot(data, aes(x = Workout_Type, y = Calories_Burned, fill = Workout_Type)) + 
  ggdist::stat_halfeye(
    adjust = .5, 
    justification = -.2, 
    .width = 0, 
    point_colour = NA
  ) +
  geom_boxplot(
    width = .12, 
    outlier.shape = NA, 
    alpha = 0.5
  ) +
  geom_jitter(
    width = .1, 
    alpha = 0.3
  ) +
  labs(title = "Raincloud Plot de Calorias Cremades de l'Exercici per Tipus d'Exercici",
       x = "Tipus d'Exercici",
       y = "Calories Cremades") +
  theme_minimal()

You can add options to executable code like this

The echo: false option disables the printing of code (only output is displayed).