From the last post, Vancouver has several common genus in its collection, such as Prunus and Acer. So rather than analyzing the diversity of Vancouver tree species on a species level, we could, with the help of some R packages, visualize the variety of taxonomic groups.
First, we format the Vancouver tree dataset similar to before to get the proper scientific name. This is the same formatting done in the previous post.
Following from the past post, this post is focused on visualizing diversity through the package vegan and also maps showing the presence of native/introduced trees.
The most important code in this post is manipulating Spatial*DataFrames.
The same files will be read in, including the native/introduced status downloaded from USDA PLANTS.
library(rgdal) library(sp) library(raster) library(dplyr) library(httr) library(rvest) library(purrr) library(tidyr) # read in trees df trees_df<-read.csv("StreetTrees_CityWide.csv", stringsAsFactors = F) trees_df<-trees_df[trees_df$LATITUDE > 40 & trees_df$LONGITUDE < -100,] # read in polygons locmap<-readOGR("cov_localareas.