library(carData) summary(Chile)
frec <- table(Chile$vote)
prop.table(frec)
frecYN <- frec[c("Y","N")]
prop.table(frecYN)
prop.test(frec["Y"], sum(frecYN)) $ conf.int
ChileYN <- droplevels (subset (Chile, vote %in% c("Y","N")))
round (with (ChileYN, prop.table (table (region, vote), 1)), 3)
y <- round (with (ChileYN, prop.table (table (population, vote), 1)), 3) [,2]
x <- as.numeric (names (y))
plot (x, y, type="b")
round (with (ChileYN, prop.table (table (sex, vote),1)), 3)
do.call (rbind, by(Chile$age, Chile$vote, summary))
educación <- factor (ChileYN$education, levels=c("P","S","PS"))
round (with (ChileYN, prop.table (table (educación, vote), 1)), 3)
y <- round (with (ChileYN, prop.table (table (income, vote), 1)), 3) [,2]
x <- as.numeric (names (y))
plot (x, y, type="b")
do.call (rbind, by(Chile$statusquo, Chile$vote, summary))
do.call (rbind, by(Chile$income, Chile$sex, summary))
do.call (cbind,
by(Chile$income, Chile$sex, quantile, probs=(0:20)/20, na.rm=TRUE))
round (100 * prop.table (table (Chile$income, Chile$sex), 2), 1)