suppressWarnings(library("tidyverse"))
library(ISUmonarch)

Cover data

Here is the cover data.frame

pander::pandoc.table(cover %>%
    head(.))

and the site data.frame in their simplest form.

pander::pandoc.table(site %>%
    head(.))

We want to combine the status of the plant before any thing was does to the plot i.e. 2016_csg_native_status and 2016_wsg_native_status with the cover data based on the class being either csg or wsg.

site16 <- ISUmonarch::site %>%
  select(siteID, transectID, `2016_csg_native_status`, `2016_wsg_native_status`) %>%
  gather("class","status",-siteID, -transectID) %>%
  mutate(class = sapply(strsplit(.$class,"_"), `[`, 2))
pander::pandoc.table(
  head(site16)
  )

After creating the above data.frame, we simply join it with the cover data.frame.

pander::pandoc.table(
  cover %>%
  left_join(site16, by=c("siteID", "transectID", "class")) %>%
  head()
  )


jarad/ISUmonarch documentation built on Aug. 10, 2022, 1:09 p.m.