For this hands on practice, load the spi
data set from the psych
package.
# Load data and convert sex and education to factors
data("spi", package="psych")
spi <- spi %>%
dplyr::rename(exercise = exer) %>%
dplyr::select(age, sex, health, p1edu, p2edu,
education, wellness,
exercise, smoke, ER) %>%
mutate(sex=factor(sex, levels=c(1,2),
labels=c("male", "female")),
wellness=factor(wellness, levels=c(1,2),
labels=c("Low", "High")),
exercise=factor(exercise, levels=c(1,2,3),
labels=c("Rarely", "Sometimes", "Often")),
ER=factor(ER, levels=c(1,2,3,4),
labels=c("None", "1x", "2x", "3+"))) %>%
na.omit()
# Write your code here!
# Write your code here!
# Write your code here!
# Write your code here!
# Write your code here
# Write your code here!
# Write your code here!
# Write your code here!
# Write your code here!
# Write your code here!
# Write your code here!
# Write your code here!