Reproducible Science and Programming

Understand the function environment & function arguments in R

This lesson introduces the function environment and documenting functions in R. When you run a function intermediate variables are not stored in the global environment. This not only saves memory on your computer but also keeps our environment clean, reducing the risk of conflicting variables.

last updated: 10 Jul 2017

Work with MODIS remote sensing data in in R.

In this lesson we will explore how to import and work with MODIS remote sensing data in raster geotiff format in R. We will cover importing many files using regular expressions and cleaning raster stack layer names for nice plotting.

last updated: 15 Jun 2017

Clean remote sensing data in R - Clouds, shadows & cloud masks

In this lesson, we will learn how to deal with clouds when working with spectral remote sensing data. We will learn how to mask clouds from landsat and MODIS remote sensing data in R using the mask() function. We will also discuss issues associated with cloud cover - particular as they relate to a research topic.

last updated: 10 Jul 2017

Adjust plot extent in R.

In this lesson we will review how to adjust the extent of a spatial plot in R using the ext() or extent argument and the extent of another layer.

last updated: 15 Jun 2017

Plot grid of spatial plots in R.

In this lesson we cover using par() or parameter settings in R to plot several raster RGB plots in R in a grid.

last updated: 15 Jun 2017

Calculate a remote sensing derived vegetation index in R

A vegetation index is a single value that quantifies vegetation health or structure. In this lesson, we will review the basic principles associated with calculating a vegetation index from raster formated, landsat remote sensing data in R. We will then export the calculated index raster as a geotiff using the writeRaster() function.

last updated: 15 Jun 2017

Landsat remote sensing tif files in R

In this lesson we will cover the basics of using LAndsat 7 and 8 in R. We will learn how to import landsat data stored in .tif format - where each .tif file represents a single band rather than a stack of bands. Finally we will plot the data using various 3 band combinations including RGB and color-infrared.

last updated: 15 Jun 2017

Extract raster values using vector boundaries in R

This lesson reviews how to extract pixels from a raster dataset using a vector boundary. We can use the extracted pixels to calculate mean and max tree height for a study area (in this case a field site where we measured tree heights on the ground. Finally we will compare tree heights derived from lidar data compared to tree height measured by humans on the ground.

last updated: 15 Jun 2017

GIS in R: Plot spatial data and create custom legends in R

In this lesson we break down the steps required to create a custom legend for spatial data in R. We discuss creating unique symbols per category, customizing colors and placing your legend outside of the plot using the xpd argument combined with x,y placement and margin settings.

last updated: 01 Aug 2017

GIS in R: Projected vs geographic Coordinate Reference Systems

This tutorial describes key differences between projected and geographic coordinate reference systems (CRSs). We focus on the Universal Trans Mercator (UTM) projected Coordinate Reference which divides the globe into zones to optimize projection results in each zone and WGS84 which is a geographic (latitude and longitude) CRS. It also briefly introduces the concept of a datum.

last updated: 18 Jul 2017

Classify a raster in R.

This lesson presents how to classify a raster dataset and export it as a new raster in R.

last updated: 15 Jun 2017

About the geotiff (.tif) raster file format - raster data in R

This lesson introduces the geotiff file format. Further it introduces the concept of metadata - or data about the data. Metadata describe key characteristics of a data set. For spatial data these characteristics including CRS, resolution and spatial extent. Here we discuss the use of tif tags or metadata embedded within a geotiff file as they can be used to explore data programatically.

last updated: 09 Aug 2017

Plot histograms of raster values in R

This lesson introduces the raster geotiff file format - which is often used to store lidar raster data. We cover the 3 key spatial attributes of a raster dataset including Coordinate reference system, spatial extent and resolution.

last updated: 15 Jun 2017

Introduction to lidar raster data products

This lesson introduces the raster geotiff file format - which is often used to store lidar raster data. We cover the 3 key spatial attributes of a raster dataset including Coordinate reference system, spatial extent and resolution.

last updated: 26 Jul 2017

Add images to a R markdown report

This lesson covers how to use markdown to add an images to a report. It also discusses good file management practices associated with saving images within your project directory to avoid losing them if you have to go back and work on the report in the future.

last updated: 15 Jun 2017

Plot Stream Discharge Data in R

This lesson is a challenge exercise that asks you to use all of the skills used during the week 2 set of lessons in the earth analytics course. Here you will import data and subset it to create a final plot of stream discharge over time.

last updated: 15 Jun 2017

Work With Date - Time formats in R - Time Series Data

This lesson covers how to deal with dates in R. It reviews how to apply the as.Date() function to a column containing date or data-time data. This function converts a field containing dates in a standard format, to a date class that R can understand and plot efficiently.

last updated: 10 Jul 2017

How to import, work with and plot spreadsheet (tabular) data in R

This lesson covers how to import, and work with tabular or spreadsheet data in R. Tabular data can contains different data classes or types in different columns. Here we learn how to identify and convert column classes from characters to numbers.

last updated: 15 Jun 2017

How to handle missing data or no data values in R - NA and NAN

Data can be missing for different reasons. This tutorial introduces how NA can be used in place of missing data values in R. It also introduces how missing data can impact calculations in R. Finally it covers how to import tabular data that may contain missing data values into R.

last updated: 15 Jun 2017

The syntax of the R scientific programming language - Data Science for Scientists 101

This lesson introduces the basic syntax associated with the R scientific programming language. We will introduce assignment operators (<-), comments and basic functions that are available to use in R to perform basic tasks including head(), qplot() to quickly plot data and others. This lesson is designed for someone who has not used R before. We will work with precipitation and stream discharge data for Boulder County.

last updated: 18 Jul 2017

R markdown Resources

This lesson contains a list of resources that will help you work with the R Markdown format.

last updated: 15 Jun 2017

Introduction to Markdown syntax - a primer

This tutorial covers the basics of the markdown syntax. Markdown is a human readable text format that is used in R Markdown files to add text to reports.

last updated: 10 Jul 2017

How to create an R Markdown file in R Studio and the R Markdown file structure.

The R Markdown file structure includes a YAML header at the top followed by a combination of R (or any other language) code and markdown formatted text. This tutorial covers how to create an R Markdown file in R and then render it to html using knitr. Further it covers the basics of the YAML syntax.

last updated: 18 Jul 2017

Create a Project & Working Directory Setup

This lessons covers the concept of a project directory compared to a working directory as used in R Studio. It also reviews how to set up a clearly organized project directory and associated file structure.

last updated: 10 Jul 2017

File Organization 101

This lesson provides a broad overview of file organization principles.

last updated: 15 Jun 2017

Install & Use Packages in R

Packages are sets of functions that perform tasks that help us work with various data structures in R. This tutorial walks you through installing and loading R packages R in RStudio.

last updated: 10 Jul 2017

Get to Know RStudio

This tutorial walks you through downloading and installing R and RStudio on your computer.

last updated: 15 Jun 2017