Learn R Programming

BSDA (version 1.01)

Gallup: Results of a Gallup poll on possession of marijuana as a criminal offense conducted in 1980

Description

Data for Exercise 2.76

Usage

Gallup

Arguments

Format

A data frame with 4 observations on the following 16 variables.

Gender

a factor with levels Female Male

Crime1

a numeric vector

No.Crime1

a numeric vector

No.Opinion1

a numeric vector

Education

a factor with levels College Grade School High School

Crime2

a numeric vector

No.Crime2

a numeric vector

No.Opinion2

a numeric vector

Age

a factor with levels 18-24 25-29 30-49 50-older

Crime3

a numeric vector

No.Crime3

a numeric vector

No.Opinion3

a numeric vector

Religion

a factor with levels Catholic Protestant

Crime4

a numeric vector

No.Crime4

a numeric vector

No.Opinion4

a numeric vector

Examples

Run this code
# NOT RUN {
INFO <- c(43,52,5,42,53,5,44,51,5,30,67,3,45,50,5,58,33,9,27,67,6,26,70,4,45,
52,3,54,39,7,49,47,4,39,55,6)
INFOmat <- matrix(INFO,nrow=12,byrow=TRUE)
INFOmat
rownames(INFOmat) <- c("National","Gender: Male","Gender: Female",
"Education: College","Education: High School","Education: Grade School",
"Age: 18-24", "Age: 25-29", "Age: 30-49", "Age: 50-older", "Religion: Protestant", 
"Religion: Catholic")
colnames(INFOmat) <- c("Criminal", "Not.Criminal", "No.Opinion")
INFOmat
barplot(t(INFOmat[2:3,]),beside=TRUE,legend=TRUE,names=c("Male","Female"),
ylab="Percent of Population Opining")
barplot((INFOmat[2:3,]),beside=TRUE,legend=TRUE,ylab="Percent of Population Opining" )
remove(INFO,INFOmat)
# }

Run the code above in your browser using DataLab