2019.06.11 (Tuesday): Program R, Central Tendency, and Variance

Richmond Mean Monthly Temperatures 1900-2019

 

The Wisdom of a Dozen People

We began class today discussing central tendencies using our own guesstimates of monthly temperature means for April, July, October, and January in Richmond. Each of the 12 attendees wrote their estimate on a sticky note, which we then binned in groups of 5°F and plotted as a histogram.

Clear central tendencies emerged, although the variance around these estimates varied by month, with April’s being symmetrically distributed around the clear mean/median, while January’s estimates were right-tail skewed.

Exploring the R Environment

We then downloaded and set up Program R and RStudio (links to their downloads here). We explored the GUI of RStudio, modifying its appearance to help us read, write, and annotate code to the best of our abilities. Dan’s preferred Editor theme is Merbivore, but everyone is free to select what works for them!

We then walked through a sample RScript (available in the Course Documents on Blackboard) to review objects, vectors, data.frames, and functions. We used these in the generation of a sample dataset with 7 observations of weather variables, and tested R’s plot() function.

We then loaded in a century of climate data from Virginia (courtesy of NOAA), learning how to:

  • Assign date values to vectors loaded as character strings.
  • Subset data.frames based on simple factor criteria.
  • Aggregate our data to extract monthly means for one weather station.

With these in hand, we were able to confirm that with just 12 estimates, our mean estimate was only 2-4°F off for each of the four months we estimated at the start of class! I guess this whole wisdom of crowds thing continues to hold…

Assignment 02

For todays assignment, students are to:

  1. Go to NOAA’s land-station data portal and find a station with more than 50 years of data; 100 years will be preferable.
  2. Request daily data for temperature.
  3. Modify the R Script from class today to find mean monthly temperature in your dataset.
  4. Create a simple but well constructed plot to change in monthly temperature. Make certain you have labeled your axes, noted the units, and given it a title. Export this plot and paste it into a word document.
  5. Write up a summary of your data in this word document, stating where the data is from, how many years it encompasses, and what variables you have calculated. Save this as a PDF and submit it to Blackboard.

 

 

Leave a Reply

Privacy Statement