Programmatic Data Access


Welcome to Week 13!

Welcome to week 13 of Earth Analytics! This week you will learn about working with twitter data to better understand disturbance events such as floods.

To follow along with the class, please be sure to download the data below. Save the data in your earth-analytics/data/week_13 directory.

Download Week 13 Data (~80 MB)

TimeTopicSpeaker
9:20 - 9:30Student Mid Term Presentation 
9:30 - 10:20Use Twitter Data To Support Natural Disaster and Emergency ResponseLise St. Dennis
10:30 - 12:00Intro to API’s & Twitter data in RLeah
12:00 - 12:20Questions / Review 

Final Presentation Notes:

Please note that will we have final presentations over the next two weeks. Similar to the mid terms, you will be required to evaluate your colleagues! Please plan on attending class for all of the final presentations.

2. Homework (3 Points)

Final Group Project Day Sign-up - (for CU Students Only)

  1. Sign up for a day to give your final presentation (next week or the week after). NOTE: if you sign up to present next week, instead of the final week of class, we will grade the analysis component accordingly. We understand that you may not be completely done with your analysis at this time. If you present early, please still plan to come to the final class to support your colleagues and participate in the course wrap up.

  2. Create a plot of the top 15 words found in the Colorado Flood tweet word counts for September 2013. This is what we did together in class. Submit your plot as an html and .Rmd file containing the code to D2L. Use this lesson to help you complete the assignment

NOTE: there is no rubric for this week’s assignment. You will get full credit if your plot is correct (see example below).

3. Bonus Opportunities (4 Points Possible):

We will not grade your code syntax for this assignment. If the plot is correct and the code to generate the plot runs, you will receive full bonus credit.

Bonus Plot 1 - Interactive Map of Boulder Flood Tweet Locations (2 Points)

Create two interactive plots of the Boulder Flood Tweet data using leaflet(). Add pop ups to your map so when you click on each point, you can view the tweet text and twitter handle associated with that point. Follow this tutorial on creating leaflet maps in R and search as you need to - to create the map.

For your map:

  • Filter the data for the first map to show the tweets surrounding the flood event: starting Sept 13-24 2013 through November 1 2013.
  • Adjust the basemap tiles in your map using the addProviderTiles() function.
  • Color each point by whether the tweet occured during the flood or after. To do this you will need to create a new column with the during / after the flood category. The code below will help you create this column.
flood_tweet_locations <- flood_tweet_locations %>%
  mutate(dur_aft = ifelse(date_time <= end_flood_date,"During", "After"))
  • When you format your popup, you can use the popup argument. The code below is an example of formatting the popup with bold for the username and a line break after the username as you see in the example map below. The data.frame name in the code below is flood_tweet_locations.
popup = paste0("<strong>", flood_tweet_locations$username,
                   "</strong><br>",
                   flood_tweet_locations$tweet_text)
Bonus Plot 2 - Population projected male population (2 Points)

Use the Colorado Information Warehouse API get population projection data for males using the following parameters:

  • Time span: 1990-2040
  • Column category: malepopulation
  • Age range: 60-80 years old

Use ggplot() to create your plot and be sure to label x and y axes and give the plot a descriptive title.

Follow this tutorial to complete this bonus activity.

Homework & Bonus Plot Examples

plot of chunk plot-top-words

Example Bonus Plot - Twitter Data Interactive Leaflet Map

Example Bonus Plot - Projected Male Population

Male population ages 60-80.

Updated: