The tutorials in this series cover how to open, work with and plot tabular
time-series data in
R. Additional topics include working with time and date
classes (e.g., POSIXct, POSIXlt, and Date), subsetting time series data by date
and time and created facetted or tiles
sets of plots.
Data used in this series cover NEON Harvard Forest Field Site and are in .csv
Series Goals / Objectives
After completing the series you will:
- Time Series 00
- Be able to open a
.csv file in
read.csv()and understand why
we are using that file type.
- Understand how to work data stored in different columns within a
- Understand how to examine
R object structures and data
- Be able to convert dates, stored as a character class, into an
- Know how to create a quick plot of a time-series data set using
- Time Series 01
- Know how to import a .csv file and examine the structure of the related
- Use a metadata file to better understand the content of a dataset.
- Understand the importance of including metadata details in your
- Know what an EML file is.
- Time Series 02
- Understand various date-time classes and data structure in
- Understand what
POSIXlt data classes are and why POSIXct
may be preferred for some tasks.
- Be able to convert a column containing date-time information in character
format to a date-time
- Be able to convert a date-time column to different date-time classes.
- Learn how to write out a date-time class object in different ways
(month-day, month-day-year, etc).
- Time Series 03
- Be able to subset data by date.
- Know how to search for NA or missing data values.
- Understand different possibilities on how to deal with missing data.
- Time Series 04
- Know several ways to manipulate data using functions in the
- Be able to use
- Write and understand
R code with pipes for cleaner, efficient coding.
- Use the
year() function from the
lubridate package to extract year from a
date-time class variable.
- Time Series 05
- Be able to create basic time series plots using
- Understand the syntax of
ggplot() and know how to find out more about the
- Be able to plot data using scatter and bar plots.
- Time Series 06
- Know how to use
facets() in the
- Be able to combine different types of data into one plot layout.
- Time Series Culmination Activity
- have applied
dplyr skills to a new data set.
- learn how to set min/max axis values in
ggplot() to align data on multiple plots.
Things You’ll Need To Complete This Series
To complete the tutorial series you will need an updated version of
preferably, RStudio installed on your computer.
is a programming language that specializes in statistical computing. It is a
powerful tool for exploratory data analysis. To interact with
R, we strongly
an interactive development environment (IDE).
Install R Packages
You can chose to install packages with each lesson or you can download all
of the necessary
R packages now.
More on Packages in R - Adapted from Software Carpentry.
The data used in this lesson were collected at the
National Ecological Observatory Network’s
Harvard Forest field site.
These data are proxy data for what will be available for 30 years on the
NEON data portal
for the Harvard Forest and other field sites located across the United States.
Set Working Directory: This lesson assumes that you have set your working
directory to the location of the downloaded and unzipped data subsets. An overview
of setting the working directory in
R can be found here.
R Script & Challenge Code: NEON data lessons often contain challenges that reinforce
learned skills. If available, the code for challenge solutions is found in the
R script of the entire lesson, available in the footer of each lesson page.
Working with Spatio-temporal Data in R Series: This tutorial series is
part of a larger
spatio-temporal tutorial series and Data Carpentry workshop.
Included series are
introduction to spatio-temporal data and data management,
working With raster data in R,
working with vector data in R
working with tabular time series in R.