The United States Geological Survey continuously monitors earth quakes and makes the corresponding data available to the public. A dataset containing all worldwide earth quakes for a time frame of 30 days is available at http://www.hofroe.net/data/earthquakes.csv.

You can find the accompanying codebook at US Geology Survey (you should be able to answer all questions in this exam without the codebook).

Update: the link to the csv file above is not valid anymore. Please use the following code to load the data

eq <- read.csv("https://raw.githubusercontent.com/DS202-at-ISU/DS202-at-ISU.github.io/master/exams/earthquakes.csv")
  1. Load the data into R. What is the time frame under consideration? How many earthquakes were there? When and where was the strongest earthquake? What was its magnitude?
# place the code for your answer here
  1. The variable ‘Country’ contains country names or states (in the case of the US). California is listed both as ‘CA’ and as ‘California’. Convert all elements in the variable from ‘CA’ to “California’.
# place the code for your answer here
  1. Which countries/states had the most earthquakes? List the top five.
    Using ggplot2, create a barchart of country, sort by frequency of earthquakes.
    Make sure that labels are readable in the barchart.
# place the code for your answer here
  1. Create a new variable ‘Country10’ in the earthquake data that contains the country names for the ten countries/states with the highest number of earthquakes, and combines all other records in a category ‘Other’.
    Show (using the ggplot2 package) boxplots of magnitude by country. Make sure to sort countries from lowest to highest median magnitude.
# place the code for your answer here
  1. Draw a histogram of magnitude of earthquakes - make sure to not get a warning message. Describe the shape of the density.
    Use the histogram to pick a suitable cutoff between ‘small’ and ‘large’ earthquakes.
# place the code for your answer here
  1. Load the maps package and extract a world map (hint: think of map_data). Plot the world map using a polygon layer. Set the fill color to grey50. Add a layer of points to the map showing the locations of earthquakes use color to distinguish between small and large earthquakes.

Describe what you see.

# place the code for your answer here
  1. Using dplyr, determine for each date
# place the code for your answer here