History Plotting repeats. Let’s dive into ggplot2
and repeat what we’ve done in base R
using the “grammar of graphics”.
Here’s the GESIS Panel data again.
library(dplyr)
library(haven)
gp_covid <-
read_sav(
"./data/ZA5667_v1-1-0.sav"
) %>%
sjlabelled::set_na(na = c(-1:-99, 97:98))
political_orientation
and hzcy001a
.
data + aesthetics + geoms
base R
function jitter does not have to be added; it just replaces the original geom
using geom_jitter()
Boxplots are boring, right? Try to plot the relationship between hzcy001a
and political_orientation
as a violin plot! Have a look here for reference: https://ggplot2.tidyverse.org/reference/
geom
? Try geom_violin()
.