Results of a Gallup poll on possession of marijuana as a criminal offense conducted in 1980
Data for Exercise 2.76
Gallup
A data frame/tibble with 1,200 observations on two variables
a factor with levels National
, Gender: Male
Gender: Female
, Education: College
, Eduction: High School
,
Education: Grade School
, Age: 18-24
, Age: 25-29
, Age: 30-49
,
Age: 50-older
, Religion: Protestant
, and Religion: Catholic
a factor with levels Criminal
, Not Criminal
, and No Opinion
George H. Gallup The Gallup Opinion Index Report No. 179 (Princeton, NJ: The Gallup Poll, July 1980), p. 15.
Kitchens, L. J. (2003) Basic Statistics and Data Analysis. Pacific Grove, CA: Brooks/Cole, a division of Thomson Learning.
T1 <- xtabs(~demographics + opinion, data = Gallup) T1 t(T1[c(2, 3), ]) barplot(t(T1[c(2, 3), ])) barplot(t(T1[c(2, 3), ]), beside = TRUE) ## Not run: library(dplyr) library(ggplot2) dplyr::filter(Gallup, demographics == "Gender: Male" | demographics == "Gender: Female") %>% ggplot2::ggplot(aes(x = demographics, fill = opinion)) + geom_bar() + theme_bw() + labs(y = "Fraction") ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.