Plotting data is fun. We also do it for data exploration (see the section on Exploratory Data Analysis). In these exercises, however, we just want to familiarize ourselves with some of the graphic facilities in R.
So let’s start with a simple task: creating a simple scatter plot. For this purpose, we first load the German General Social Survey - ALLBUS 2021 SUBSET.
library(dplyr)
library(haven)
allbus_2021_dvI <-
read_sav(
"./data/allbus_2021ZA5280_v1-0-0.sav"
) %>%
sjlabelled::set_na(na = c(-1:-99, 97:98))
Now let’s plot an actual variable from the dataset.
pa01
(political_orientation) and fr03b
(children suffer under working mothers).
plot()
command.
jitter()
function. Have a look at ?jitter
for more details on using the function.
ColourPicker
add-in for more modern colors?