# Condense party identification (PID) column into three categories
party <- nes96$PID
levels(party) <- c(
"Democrat", "Democrat",
"Independent", "Independent", "Independent",
"Republican", "Republican"
)
# Convert income to numeric
inca <- c(1.5, 4, 6, 8, 9.5, 10.5, 11.5, 12.5, 13.5, 14.5, 16, 18.5, 21, 23.5,
27.5, 32.5, 37.5, 42.5, 47.5, 55, 67.5, 82.5, 97.5, 115)
income <- inca[unclass(nes96$income)]
# Construct new data set for analysis
rnes96 <- data.frame(
"party" = party,
"income" = income,
"education" = nes96$educ,
"age" = nes96$age
)
# Print summary of data set
summary(rnes96)