library(RCPA3)POL 300: Lab 6
This page contains R code for Lab 6.
Instructions
To complete this lab:
- create a new R script on your computer
- save it under the name
POL 300 Lab 6.R - copy and paste the code from this page (in the gray boxes) into the script
- comment the code as instructed during the lab
Code
crosstabC(dv = icc.treaty.ratified, iv = region,
data = world,
plot = "bar", plot.response = "Yes")crosstabC(dv = icc.treaty.ratified, iv = gdp.percap.5cat,
data = world,
plot = "line", plot.response = "Yes")crosstabC(dv = tax.source, iv = region,
data = states,
plot = "bar", plot.response = "all",
compact = TRUE)states$population.3cat <- transformC(type = "cut",
x = states$population,
groups = 3)
crosstabC(dv = tax.source, iv = population.3cat,
data = states,
plot = "line", plot.response = "all",
compact = TRUE,
ivlabs = c("Small", "Medium", "Large"))world$infant.mortality.3cat <- transformC(type = "cut",
x = world$infant.mortality,
groups = 3,
confirm = FALSE)
freqC(x = infant.mortality.3cat, data = world)
compmeansC(dv = fertility, iv = infant.mortality.3cat,
data = world,
plot = "line",
ivlabs=c("Low", "Moderate", "High"))boxplotC(dv = infant.mortality,
iv = region,
data = world,
main = "Infant mortality by region",
xlab = "",
ylab = "Infant mortality")plot(x = world$gdp.percap, y = world$infant.mortality,
xlab = "Per Capita Gross Domestic Product",
ylab = "Infant Mortality Rate",
main = "Relationship between Per Capita GDP & Infant Mortality")