The goal of this lesson is to learn how to import datasets into R, understand variable types, make adjustments to variables, perform basic calculations, and begin data visualization. The exercise uses an over 100 year time series of climate data.
Listed in Teaching Materials | resource by group Make Teaching with R in Undergraduate Biology Less Excruciating
This lesson is part of a Global Change Biology course where one of the main learning objectives is to have the students develop and answer scientific questions by using R to access, organize, and graph actual long-term data sets. In order to explore global change data and learn how various anthropomorphic activities are affecting ecosystems and species, we need to import datasets into R and make sure all the variables are in the correct format that will allow us to perform data visualization (aka, create graphs). In this lesson, we will learn how to import data into R, perform basic QA/QC (quality assurance/quality control) of the data, and create some basic exploratory graphs of the data from which we can begin to answer scientific questions. We will be working with a dataset from the PRISM Climate Group (http://www.prism.oregonstate.edu/) that includes air temperature and precipitation over the past one hundred years in two towns in the United States (Boulder, CO and Hanover, NH). This resource also includes a graphing homework assignment and key that can be used as an assessment and extension of learning after students complete the swirl lesson.
- You will learn how to import data into R and perform basic QA/QC.
- You will learn about different data and variable formats you will encounter in this course (and throughout your data ‘career’).
- You will learn how to manipulate date variables in R in order to get them into the format you need for data visualization.
- You will learn how to use piping in R (from tidyverse package) to subset the data and perform basic calculations with the data.
- You will be able to create simple graphs to visualize data in order to answer scientific questions.
While the majority of this lesson was built from scratch, The graphing part of this lesson was modified from the existing swirl lesson GGPlot2_Part1 in the Exploratory_Data_Analysis course (https://github.com/swirldev/swirl_courses/blob/master/Exploratory_Data_Analysis/GGPlot2_Part1/lesson).
Climate data used in this lesson was downloaded from the PRISM Climate Group (http://www.prism.oregonstate.edu/).
Cite this work
Researchers should cite this work as follows:
- Pries, C. H. (2019). Working with Datasets in R swirl. Make Teaching with R in Undergraduate Biology Less Excruciating, QUBES Educational Resources. doi:10.25334/Q4KF2V
Make Teaching with R in Undergraduate Biology Less Excruciating
This publication belongs to the Make Teaching with R in Undergraduate Biology Less Excruciating group.
When watching a resource, you will be notified when a new version is released.