The tutorials in this workshop cover how to open, work with and plot with spatial data, in vector format (points, lines and polygons) in R. Topics covered include working with spatial metadata: extent and coordinate reference system, working with spatial attributes and plotting data by attributes. Data used in this series cover NEON Harvard Forest Field Site and are in Shapefile and .csv format.
R Skill Level: Beginner - you’ve got the basics of R
down but haven’t worked with
spatial data in R
before.
After completing the lessons in this series you will:
To complete this lesson: you will need the most current version of R, and preferably RStudio, loaded on your computer.
install.packages("raster")
install.packages("rgdal")
install.packages("sp")
install.packages("ggplot2")
More on Packages in R - Adapted from Software Carpentry.
These vector data provide information on the site characterization and infrastructure at the National Ecological Observatory Network’s Harvard Forest field site. The Harvard Forest shapefiles are from the Harvard Forest GIS & Map archives. US Country and State Boundary layers are from the US Census Bureau.
The LiDAR and imagery data used to create this raster teaching data subset were collected over the National Ecological Observatory Network’s Harvard Forest and San Joaquin Experimental Range field sites and processed at NEON headquarters. The entire dataset can be accessed by request from the NEON Airborne Data Request Page on the NEON website.
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
downloadable R
script of the entire lesson, available in the footer of each lesson page.
Data Carpentry Lesson Series: This workshop part of a larger
spatio-temporal Data Carpentry Workshop
that includes working with
raster data in R
and
tabular time series in R .