Skip to content

Commit

Permalink
read_formtransect returns all species if training = T, Savspecies col…
Browse files Browse the repository at this point in the history
…umn now called Species
  • Loading branch information
fawda123 committed Jul 25, 2024
1 parent bebacf5 commit 3b05d38
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: tbeptools
Title: Data and Indicators for the Tampa Bay Estuary Program
Version: 2.0.1.9026
Date: 2024-07-18
Version: 2.0.1.9027
Date: 2024-07-25
Authors@R: c(
person(given = "Marcus",
family = "Beck",
Expand Down
12 changes: 6 additions & 6 deletions R/read_formtransect.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ read_formtransect <- function(jsn, training = FALSE, raw = FALSE){
return(out)

out <- out %>%
dplyr::select(yr = AssessmentYear, Crew, MonitoringAgency, Site, Depth, Savspecies = Species, Abundance = SpeciesAbundance,
dplyr::select(yr = AssessmentYear, Crew, MonitoringAgency, Site, Depth, Species, Abundance = SpeciesAbundance,
matches('BladeLength_|ShootDensity_')) %>%
dplyr::select(-BladeLength_Avg, -BladeLength_StdDev, -ShootDensity_Avg, -ShootDensity_StdDev) %>%
dplyr::mutate(
Expand All @@ -51,9 +51,10 @@ read_formtransect <- function(jsn, training = FALSE, raw = FALSE){
grepl('[a-z,A-Z]', Abundance) ~ NA_character_,
T ~ Abundance
),
Abundance = as.numeric(Abundance)
Abundance = as.numeric(Abundance),
Species = gsub('\\r\\n', '', Species)
) %>%
tidyr::gather('var', 'val', -yr, -Crew, -MonitoringAgency, -Site, -Depth, -Savspecies) %>%
tidyr::gather('var', 'val', -yr, -Crew, -MonitoringAgency, -Site, -Depth, -Species) %>%
dplyr::group_by(yr) %>%
dplyr::mutate(
rep = gsub('.*([0-9])$', '\\1', var),
Expand All @@ -76,13 +77,12 @@ read_formtransect <- function(jsn, training = FALSE, raw = FALSE){
grp = as.character(grp)
) %>%
dplyr::ungroup() %>%
dplyr::group_by(yr, grp, grpact, Crew, MonitoringAgency, Site, Depth, Savspecies, var) %>%
dplyr::group_by(yr, grp, grpact, Crew, MonitoringAgency, Site, Depth, Species, var) %>%
dplyr::summarise(
aveval = mean(val, na.rm = T),
sdval = sd(val, na.rm = T)
) %>%
dplyr::ungroup() %>%
dplyr::filter(Savspecies %in% c('Halodule', 'Syringodium', 'Thalassia', 'Halophila', 'Ruppia'))
dplyr::ungroup()

}

Expand Down
2 changes: 1 addition & 1 deletion R/show_compplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ show_compplot <- function(transect, yr, site, species = c('Halodule', 'Syringodi
toplo <- transect %>%
dplyr::filter(yr %in% !!yr) %>%
dplyr::filter(Site %in% site) %>%
dplyr::filter(Savspecies %in% species) %>%
dplyr::filter(Species %in% species) %>%
dplyr::filter(var %in% varplo)

# get summary stats
Expand Down

0 comments on commit 3b05d38

Please sign in to comment.