View source: R/Uncountedyears.R
Uncountedyears | R Documentation |
Detects years when a species was present in the system (i.e., post-invasion for invasive species) but not counted in each zooplankton survey
Uncountedyears(Source, Size_class, Crosswalk, Start_year, Intro_lag)
Source |
String with the name of the source dataset (e.g., |
Size_class |
String with the name of the desired zooplankton size class (e.g., |
Crosswalk |
Crosswalk table like |
Start_year |
First year the |
Intro_lag |
Number of years buffer after a species is introduced when we expect surveys to start recording them. Effectively adds |
This function is designed to work on one source and size class at a time. To apply across multiple IDs, use the map or apply functions.
A tibble with columns for the Taxlifestage, Taxname, Lifestage, Source, Sizeclass, and then a list-column of years in which that particular taxon was not counted in the specified study and size class. Taxa that were counted in all applicable years are not included in the tibble.
Sam Bashevkin
Zoopsynther
, crosswalk
, startDates
require(purrr)
require(dplyr)
require(lubridate)
datasets<-zooper::zoopComb%>%
mutate(names=paste(Source, SizeClass, sep="_"))%>%
select(names, Source, SizeClass)%>%
filter(Source%in%c("EMP", "FMWT", "twentymm"))%>%
distinct()
BadYears<-map2_dfr(datasets$Source, datasets$SizeClass, ~ Uncountedyears(Source = .x,
Size_class = .y,
Crosswalk = zooper::crosswalk,
Start_year = zooper::startDates%>%
filter(Source==.x & SizeClass==.y)%>%
pull(Startdate)%>%
year(),
Intro_lag=2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.