library(flexdashboard) library(drake) library(gt) library(reactable) library(wastdr)
wastd_data <- drake::readd("wastd_data")
# helpers > move to wastdr filter_calendar_year_2021 <- . %>% dplyr::mutate(calendar_year = datetime %>% lubridate::year()) %>% dplyr::filter(calendar_year==2021)
# surveys ---------------------------------------------------------------------# surveys <- wastd_data$surveys %>% dplyr::mutate(datetime = start_time) %>% filter_calendar_year_2021() %>% # wastdr::filter_wastd_season(2020) %>% wastdr::filter_realsurveys() svy_stats <- surveys %>% wastdr::survey_season_stats() # tracks ----------------------------------------------------------------------# tracks <- wastd_data$tracks %>% # wastdr::filter_wastd_season(2020) %>% filter_calendar_year_2021() %>% wastdr::filter_realspecies() no_tracks <- tracks %>% nrow() # animals ---------------------------------------------------------------------# turtles <- wastd_data$animals %>% # wastdr::filter_wastd_season(2020) %>% filter_calendar_year_2021() %>% dplyr::filter(taxon == "Cheloniidae") %>% wastdr::filter_realspecies() # AnimalEncounters with alive turtles in cal year 2021 excluding training records turtles_tagged <- turtles %>% filter_alive() %>% dplyr::filter(encounter_type == "tagging") no_turtles_tagged <- turtles_tagged %>% nrow() animal_enc_types_area <- turtles %>% dplyr::group_by(encounter_type, area_name, species) %>% dplyr::tally() %>% dplyr::ungroup() %>% tidyr::spread(encounter_type, n) animal_enc_types <- turtles %>% dplyr::group_by(encounter_type, species) %>% dplyr::tally() %>% dplyr::ungroup() %>% tidyr::spread(encounter_type, n)
turtles_tagged %>% map_mwi(sites=wastd_data$sites, cluster=TRUE, split_species=TRUE)
# Stats go per season == FY, filter by cal year gets two rows needing to sum flexdashboard::valueBox( sum(svy_stats$number_surveys), caption = "Surveys", icon="fa-pencil")
flexdashboard::valueBox( sum(svy_stats$hours_surveyed), caption = "Survey hours", icon="fa-hourglass-half")
flexdashboard::valueBox( no_turtles_tagged, caption = "Turtles Tagged", icon="fa-eye")
flexdashboard::valueBox( no_tracks, caption = "Turtle Tracks", icon="fa-shoe-prints")
All of WA
animal_enc_types %>% dplyr::mutate( species=stringr::str_to_sentence(species) %>% stringr::str_replace("-"," ") ) %>% janitor::clean_names(case="title") %>% gt::gt()
DBCA core programs: Thevenard, Delambre, Eco Beach, Roebuck Bay
animal_enc_types_area %>% dplyr::filter( area_name %in% c( "Delambre Island", "Thevenard Island", "Eco Beach", "Roebuck Bay" ) ) %>% dplyr::mutate( species=stringr::str_to_sentence(species) %>% stringr::str_replace("-"," ") ) %>% janitor::clean_names(case="title") %>% reactable::reactable(filterable = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.