knitr::opts_chunk$set(echo = TRUE)
library(arcgisbinding)
library(AIMtools)
arc.check_product()
data_2020<-load_data(year = 2020)

data_2019<-load_data(year = 2019)

Species Richness

Species Richness Playground

data_2019[["unknown_plants"]]%>%
  as_tibble()%>%
  View()

data_2020[["unknown_plants"]]%>%
      as_tibble()%>%
      filter(grepl("COS01000|Tres Rios", Office))%>%
      select(UnknownCode, FinalCode)

data_20[["spec_rich_detail"]]%>%
      filter(grepl("Tres Rios|COS01000|TRFO", RecKey))%>%
      mutate(species_code=FinalCode)
      ##left_join(unknowns, by="UnknownCode")%>%
      ##mutate(species_code=ifelse(!is.na(FinalCode), FinalCode, SpeciesList))

Testing Final Species Rich Functions

test<-sp_rich(data_2020)
join_1<-dplyr::select(dima_18$lines, LineKey, PlotKey)%>%
  dplyr::mutate(PlotKey=as.character(PlotKey))

join_2<-dplyr::select(dima_18$plots, PlotKey, PlotID)%>%
  dplyr::mutate(PlotKey=as.character(PlotKey))



dima_18$sp_rich_detail%>%
      dplyr::select(-SpeciesCount)%>%
      tidyr::unnest(symbol = stringr::str_split(SpeciesList, ";"))%>%
      dplyr::select(-SpeciesList)%>%
      dplyr::filter(symbol!="")%>%
      dplyr::left_join(dplyr::select(dima_18$sp_rich_header, LineKey, RecKey), by="RecKey" )%>%
      dplyr::left_join(join_1)%>%
      dplyr::left_join(join_2)

Species Rich

By Plot tests

names(data_20)

data_2020$spec_rich_detail%>%
  dplyr::filter(grepl("Tres Rios|COS01000|TRFO", RecKey))%>%
  dplyr::left_join(dplyr::select(data_2020a$species_richness, PlotID, globalid), by=c("parentglobalid"="globalid"))
  View()
cleaned_species_rich<-agol_2020[["spec_rich_detail"]]%>%
      tibble::as_tibble()%>%
      dplyr::left_join(dplyr::select(agol_2020$species_richness, PlotID, globalid), by=c("parentglobalid"="globalid"))%>%
      dplyr::mutate(species_code=SpeciesList,
                    SpeciesList=ifelse(!is.na(UnknownCode), UnknownCode, SpeciesList))


mschmidty/AIMtools documentation built on Sept. 29, 2022, 7:40 p.m.