Data Viz

Use the CIACountries dataset in the mdsr package and the ggplot2 package to create a three, four, or five dimensional graphical display which tells a story.

  1. You should first put your first names in the YAML header above.

  2. You should next run the commands

library(mdsr)
mplot(CIACountries)
  1. Next select the 2-variable option, setting Graphics System to ggplot2, then setting various parameters.

  2. Once you have a graph that you and your group like, click Show Expression to grab the ggplot2 commands which generated it, then paste that code into the following code chunk.

  3. Add a paragraph that summarizes your insight

  4. Publish your findings to Rpubs (username: STAT231, password: to be provided)

# your code goes here
ggplot(data = CIACountries, aes(x = oil_prod, y = gdp)) + geom_point()  + aes(colour = net_users) + aes(size = pop) + theme(legend.position = "right") + labs(title = "")
## Warning: Removed 24 rows containing missing values (geom_point).

SUMMARY: We looked at the relationship between oil production and GDP. While there were plenty of countries with substantial GDPs without any (or relatively little) oil production, if we ignore the countries with high oil production there is a slight positive correlation between oil production and GDP. We mapped population to the size of each data point and color to the percent of internet users in each country. We didn’t find any relationship between population and GDP or oil production but saw a clear relationship between GDP and internet users. As a country’s GDP increased, so did the number of internet users.