Chapter 5 Species

5.1 Creating a species list

Here is a brief introduction to create a species list from your selected set in NASIS. This can be helpful to provide to folks who are less familiar with the vegetation of an area, so that they know what species have been observed. The function accesses the USDA PLANTS database and returns modern taxonomies if old taxa exist in the dataset, functional class, plant family, and native status.

species_list <- ecositer::species_list(SS = TRUE)
##   Current.Symbol           Current.Sci.Name Accepted.Symbol
## 1          LOIN4        Lonicera interrupta           LOIN4
## 2           TODI Toxicodendron diversilobum            TODI
## 3          CASO2      Calystegia soldanella           CASO2
## 4          GATR2            Galium trifidum           GATR2
## 5          GATR3           Galium triflorum           GATR3
## 6          CLLA3         Clematis lasiantha           CLLA3
##            Accepted.Sci.Name             Common.Name    Growth.Habit
## 1        Lonicera interrupta   chaparral honeysuckle     Vine, Shrub
## 2 Toxicodendron diversilobum      Pacific poison oak     Vine, Shrub
## 3      Calystegia soldanella seashore false bindweed Vine, Forb/herb
## 4            Galium trifidum     threepetal bedstraw Vine, Forb/herb
## 5           Galium triflorum       fragrant bedstraw Vine, Forb/herb
## 6         Clematis lasiantha       pipestem clematis            Vine
##                   Native.Status         Family        Order
## 1                        L48(N) Caprifoliaceae   Dipsacales
## 2                  L48(N)CAN(N)  Anacardiaceae   Sapindales
## 3                  L48(N)CAN(N) Convolvulaceae    Solanales
## 4  L48(N)AK(N)CAN(N)GL(N)SPM(N)      Rubiaceae     Rubiales
## 5 L48(N)AK(N)CAN(N)GL(I?)SPM(N)      Rubiaceae     Rubiales
## 6                        L48(N)  Ranunculaceae Ranunculales

5.2 Working with vegetation data

To begin with, we will query plot level NASIS data using the query outlined in Accessing plot level vegetation data. Then, run ecositer::vegStaticNASIS() and ecositer::formatted_veg_df(). See the

Vegetation data QC is a critical step in ecological data analysis. The USDA plants database improves vegetation data quality, ensuring proper scientific names are used, but additional QC must be performed. One of the primary tasks will be dealing with identifications to different taxonomic levels (i.e., genus, species, and subspecies). Statistical approaches think of each class separately and therefore do not recognize any similarity between taxonomic levels. For example, statistical analyses do not recognize any relationship between Pinus, Pinus contorta, and Pinus contorta var. murrayana. For this reason, you will need to determine how to modify your data based on the characteristics of your data set and expert knowledge. This will likely need to be done on a species-by-species basis. The ultimate goal is to group all of the observations of one organism into one class.

Below is an example of this process and code you can use to assist:

To begin with, I will look at all of the plant names used:

5.3 Mapping the location of species

Let’s take a look at the location of species. To do this we will query plot level NASIS data using the query outlined in Accessing plot level vegetation data.

Once you have queried, you can filter your dataset for any species of interest. I am going to search for a genus - Artemisia (sagebrush). Ultimately, we will produce a map that shows the distribution of all the species of Artemisia.

veg_data <- fetchVegdata(dsn = "C:/Users/Nathan.Roe/Documents/SEKI/CA792_veg_data.sqlite", SS = FALSE)
## NOTE: some siteobsiid have surface fragment cover >= 100%
artemesia_df <-
  veg_data$vegplotspecies %>% filter(plantsciname %in% str_subset(veg_data$vegplotspecies$plantsciname, "Artemisia")) %>%
  select(siteiid, plantsciname)

Query for Artemisia and create a spatial dataframe with coordinates

artemesia_df <-
  veg_data$vegplotspecies %>% filter(plantsciname %in% str_subset(veg_data$vegplotspecies$plantsciname, "Artemisia")) %>%
  select(siteiid, plantsciname)

artemesia_location <-
  veg_data$vegplotlocation %>% dplyr::filter(siteiid %in% artemesia_df$siteiid) %>% select(siteiid, utmzone, utmeasting, utmnorthing) %>%
  dplyr::left_join(artemesia_df) %>% st_as_sf(coords = c('utmeasting', 'utmnorthing'),
                                              crs = st_crs(32611))
## Joining with `by = join_by(siteiid)`
## Warning in dplyr::left_join(., artemesia_df): Detected an unexpected many-to-many
## relationship between `x` and `y`.
## ℹ Row 1 of `x` matches multiple rows in `y`.
## ℹ Row 7 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected,
##   set `relationship = "many-to-many"` to
##   silence this warning.

Create a list of dataframes based on the different

veg_data <- fetchVegdata(dsn = "C:/Users/Nathan.Roe/Documents/SEKI/CA792_veg_data.sqlite", SS = FALSE)
## NOTE: some siteobsiid have surface fragment cover >= 100%
artemesia_df <-
  veg_data$vegplotspecies %>% filter(plantsciname %in% str_subset(veg_data$vegplotspecies$plantsciname, "Artemisia")) %>%
  select(siteiid, plantsciname)

artemesia_location <-
  veg_data$vegplotlocation %>% dplyr::filter(siteiid %in% artemesia_df$siteiid) %>% select(siteiid, utmzone, utmeasting, utmnorthing) %>%
  dplyr::left_join(artemesia_df) %>% st_as_sf(coords = c('utmeasting', 'utmnorthing'),
                                              crs = st_crs(32611))
## Joining with `by = join_by(siteiid)`
## Warning in dplyr::left_join(., artemesia_df): Detected an unexpected many-to-many
## relationship between `x` and `y`.
## ℹ Row 1 of `x` matches multiple rows in `y`.
## ℹ Row 7 of `y` matches multiple rows in `x`.
## ℹ If a many-to-many relationship is expected,
##   set `relationship = "many-to-many"` to
##   silence this warning.
artemesia_location_split <-  split(artemesia_location, artemesia_location$plantsciname)


my_colors <- RColorBrewer::brewer.pal(n = length(artemesia_location_split), name = 'Set1')


mapview::mapView(artemesia_location_split, col.regions = my_colors)

It can be really useful to create a stored version of your selected set. That way, if you are frequently changing between different different selected sets, you do not have to clear your selected set and run a new query. This can be done by saving your selected set as an SQlite database. This allows you to call the saved SQlite database in SoilDB functions.

Let’s look at how we can create a stored SQlite database.

soilDB::createStaticNASIS(SS = TRUE, tables = 
      soilDB::get_NASIS_table_name_by_purpose(c("area", "legend", "mapunit", "datamapunit", "component", "metadata", "lookup", "nasis")),
      output_path = "C:/Users/Nathan.Roe/Documents/SEKI/CA792_veg_data.sqlite")

Note: The tables listed in the get_NASIS_table_name_by_purpose argument should cover the majority of situations. If you run into an issue, though, soilDB will likely name a specific table that is missing. If that happens, you will have to add the table to the character vector.

Once you have stored your SQlite database, you can call it using the soilDB functions. The default argument in fetchNASIS() and other SoilDB functions is SS = TRUE. We are going to change that to false and identify the location of the SQlite database in the dsn argument.

my.components.MLRA <- fetchNASIS(from = "components", duplicates = T, dsn = "C:/Users/Nathan.Roe/Documents/SEKI/CA792_veg_data.sqlite", SS = FALSE)

This can be extremely useful when you have multiple selected sets that you are working with.