Skip to main content

Section 10.6 Checking a Correlation Coefficient

You may want to confirm if there is a positive correlation between low self-control and risky lifestyles. You can conduct a correlation analysis such as the one we covered in the previous chapter.
library(tidyverse)
Inmate_Survey %>%
  summarize(correlation_lsc_rl = cor(LSC, RL, use = "pairwise.complete.obs"),
            sample_size = n())
There were missing values in our dataset. The pairwise.complete.obs argument allows us to compute the correlation using complete pairs of observations, effectively handling missing values pairwise.