Gallup {BSDA} | R Documentation |
Results of a Gallup poll on possession of marijuana as a criminal offense conducted in 1980
Description
Data for Exercise 2.76
Usage
Gallup
Format
A data frame/tibble with 1,200 observations on two variables
- demographics
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
, andReligion: Catholic
- opinion
a factor with levels
Criminal
,Not Criminal
, andNo Opinion
Source
George H. Gallup The Gallup Opinion Index Report No. 179 (Princeton, NJ: The Gallup Poll, July 1980), p. 15.
References
Kitchens, L. J. (2003) Basic Statistics and Data Analysis. Pacific Grove, CA: Brooks/Cole, a division of Thomson Learning.
Examples
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)
[Package BSDA version 1.2.2 Index]