NEON EDUCATION bio photo

NEON EDUCATION

Devoted to open data and open source in science and education.

View All Tutorials

Tags

R programming (52)
Hierarchical Data Formats (HDF5) (15)
Spatial Data & GIS (22)
LiDAR (10)
Raster Data (14)
Remote Sensing (25)
Data Visualization (4)
Hyperspectral Remote Sensing (18)
Time Series (15)
Phenology (7)
Vector Data (6)
Metadata (1)
Git & GitHub (7)
(1) (1) (14)

Tutorial by R Package

dplyr (7)
ggplot2 (16)
h5py (2)
lubridate (time series) (6)
maps (1)
maptools (1)
plyr (2)
raster (26)
rasterVis (raster time series) (3)
rgdal (GIS) (24)
rgeos (2)
rhdf5 (11)
sp (5)
scales (4)
gridExtra (4)
ggtheme (0)
grid (2)
reshape2 (3)
plotly (5)

View ALL Tutorial Series




Twitter Youtube Github


Blog.Roll

R Bloggers
Date(s): - Aug 7, 2016

Overview

This 3.5-hr workshop, taught at the 2016 meeting of the Ecological Society of America (ESA) in Ft. Lauderdale, FL, will cover how to open, work with and plot tabular (.csv format) 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.

All materials taught in this workshop were developed in collaborative effort between Data Carpentry and the National Ecological Observatory Network (NEON).

Required Prior Knowledge

The workshop will assume that participants have a basic level of familiarity with working with data in R, including installing and loading packages and data import.


This workshop will be taught at the 2016 meeting of the Ecological Society of America (ESA) in Ft. Lauderdale, FL. You must be a registered attendee of the conference and register for this workshop to participate in this workshop. For more information, visit the ESA 2016 annual meeting website.

Things You’ll Need For The Workshop

To participant in this workshop, you will need a laptop with the most current version of R, and preferably RStudio, loaded on your computer.

For details on setting up RStudio in Mac, PC, or Linux operating systems, please see the instructions below.

Install R Packages

Please have these packages installed and updated prior to the start of the workshop.

  • ggplot2: install.packages("ggplot2")
  • lubridate: install.packages("lubridate")
  • scales: install.packages("scales")
  • gridExtra: install.packages("gridExtra")
  • reshape2: install.packages("reshape2")
  • zoo: install.packages("zoo")

Updating R Packages

In RStudio, you can go to Tools --> Check for package updates to update previously installed packages on your computer.

Or you can use update.packages() to update all packages that are installed in R automatically.

Download Data

Download NEON Teaching Data Subset: Meteorological Data for Harvard Forest

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.

Once you have downloaded the data, please set up a “data” directory as a parent directory to these three uncompressed directories. Set your R working directory to this “data” directory prior to the beginning of the workshop. If you would like further instruction please see the bottom of this page for detailed instructions.

Workshop Instructors

  • Megan A. Jones; @meganahjones, Staff Scientist/Science Educator; NEON program, Battelle
  • Samantha Weintraub; @sr_weino, Staff Scientist, Terrestrial Biogeochemist; NEON program, Battelle

Please get in touch with the instructors prior to the workshop with any questions.

#WorkWithData Hashtag

Please tweet using the hashtag #WorkWithData during this workshop!

Workshop Schedule

Location: Ft Lauderdale Convention Center, Rm 316 Please double check the conference schedule as rooms may change!

Please note that the schedule listed below may change depending upon the pace of the workshop!

Time Topic
7:45 Please come early if you have any setup or installation issues
8:00 Intro to Time Series Data in R
9:00 Dealing With Dates & Times in R
9:30 ——— BREAK ———
9:45 NoData Values & Subsetting by Date
10:10 Time Series Plots with ggplot2
10:40 Multi-panel Plots with ggplot Facets
11:15 Additional Questions & Evaluation
11:30 End

Online Tutorials

All NEON workshops and self-paced tutorials can be accessed via the NEON Data Skills portal. The materials in this workshop will parallel those presented in the Introduction to Working With Time Series Data in Text Formats in R series. ***

Additional Set Up Resources

Set Working Directory to Downloaded Data

1) Download Data

First, download the data linked to the blue buttons in the Download Data section.

  • NEON Teaching Data Subset: Meteorological Data for Harvard Forest
Screenshot of the computer's Downloads folder containing the new NEONDSMetTimeSeries.zip file. Source: National Ecological Observatory Network (NEON)

After clicking on the Download Data button, the data will automatically download to the computer.

2) Locate .zip file

Second, find the downloaded .zip file. Many browsers default to downloading to the Downloads directory on your computer. Note: You may have previously specified a specific directory (folder) for files downloaded from the internet, if so, the .zip file will download there.

3) Move to data directory

Third, move the data files to a directory called data directory within the Documents directory on your computer.

4) Unzip/uncompress

Fourth, we need to unzip/uncompress the file so that the data files can be accessed. Use your favorite tool that can unpackage/open .zip files (e.g., winzip, Archive Utility, etc). The files will now be accessible in the directory:

  • NEON-DS-Met-Time-Series

These directories contain all of the subdirectories and files that we will use in this workshop.

Your directory should now look like this with the exception that you will NOT have the NEON-DS-Site-Layout-Files directory:

Screenshot of the neon directory with the nested Documents, data, NEON-DS-Met-Time-Series, and other directories. Source: National Ecological Observatory Network (NEON)

Windows R/RStudio Setup

Once R and R studio are installed, open RStudio to make sure it works and you don’t get any error messages.

Mac R/RStudio Setup

  • If your Mac is set up for UiO use, you can install R from Managed Software Center

  • Go to CRAN and click on Download R for (Mac) OS X
  • Select the .pkg file for the version of OS X that you have and the file will download.
  • Double click on the file that was downloaded and R will install
  • Go to the RStudio Download page
  • Under Installers select RStudio 0.98.1103 - Mac OS X 10.6+ (64-bit) to download it.
  • Once it’s downloaded, double click the file to install it

Once R and R studio are installed, open RStudio to make sure it works and you don’t get any error messages.

Linux R/RStudio Setup

  • R is available through most Linux package managers. You can download the binary files for your distribution from CRAN. Or you can use your package manager (e.g. for Debian/Ubuntu run sudo apt-get install r-base and for Fedora run sudo yum install R).
  • To install RStudi, go to the RStudio Download page
  • Under Installers select the version for your distribution.
  • Once it’s downloaded, double click the file to install it

Once R and R studio are installed, open RStudio to make sure it works and you don’t get any error messages.