library(ggplot2)
temp <- tempfile()
download.file("https://www.pilesofvariance.com/Chapter6/SPSS/SPSS_Chapter6.zip", temp)
dataset <- haven::read_sav(unz(temp, "SPSS_Chapter6/SPSS_Chapter6.sav"))
unlink(temp)
ggplot(dataset, aes(session, rt))+
stat_smooth(aes(color = factor(PersonID)),
se = FALSE,
alpha = 0.9, show.legend = FALSE) +
geom_point(color = "#b65944", position = position_jitter(0.3)) +
scale_color_manual(
values = sample(c("#c9190e", "#ccba82", "#daca89", "#d2c291", "#c8b04f"),
size = 101, replace = TRUE)
) +
scale_x_continuous("Session", breaks = 1:6) +
scale_y_continuous("Reaction Time", labels = scales::label_comma()) +
theme_bw() +
labs(caption = glue::glue("Data from {N} people, over 6 sessions.",
N = nlevels(factor(dataset$PersonID))))
#> `geom_smooth()` using method = 'loess' and formula = 'y ~ x'
Created on 2024-10-29 with reprex v2.1.1