Calculating species richness from a matrix of species abundancesOctober 7, 2016Here I demonstrate how to calculate species richness from species abundance or cover data. I’ll use a vegetation cover dataset from Bryce Canyon National Park: http://ecology.msu.montana.edu/labdsv/R/labs/lab2/lab2.html
We can see that the data are organized by rows of sites, and each site has plant cover data, organized by species into columns. Because this is cover data and not occurrence data (1s and 0s), we can’t just sum all of the values across each row to calculate species richness for each site. Instead, we have to tally all of the non-zero occurrences across rows. To do this, we use the built in
We can now examine the distribution and summary statistics of species richness across sites in Bryce Canyon.
Manual Scale in ggplot2Megan KressOctober 5, 2016
Manual ScaleIf you are want to use ggplot2 to plot two different data frames, you probably want the two data frames to be represented by different colors. Using the geom_point function, you can easily assign different colors to the different sets of data, but creating a legend for two different data frames in one ggplot is more less intuitive. The code below explains how to take two data frames and plot them together with a legend that explains the colors for each of the data sets. This code uses teh scale_colour_manual function from ggplot2.
R Code
|
Spatial Ecology @ MSUClick on "Category" below to search for R code compiled by the Zarnetske Spatial & Community Ecology Lab and students in MSU's Spatial Ecology graduate course (FOR870/FW870) Category
All
Archive
October 2016
|