Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ NEWS.rmd
README.rmd
^data-raw$
cran-comments.md
^\.positai$
^\.claude$
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ Meta
/doc/
/Meta/
LICENSE.md
.positai
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: BioMonTools
Type: Package
Title: Biomonitoring and Bioassessment Calculations
Version: 1.2.4.9012
Version: 1.2.4.9013
Authors@R: c(
person("Erik W.", "Leppo",
email="Erik.Leppo@tetratech.com",
Expand Down
8 changes: 5 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ export(metvalgrpxl)
export(qc.checks)
export(qc_taxa)
export(qc_taxa_match_official)
export(qc_taxa_values_ffg)
export(qc_taxa_values_habit)
export(qc_taxa_values_tolval)
export(qc_taxa_names_proof)
export(qc_taxa_phylo)
export(qc_taxa_values_char)
export(qc_taxa_values_logical)
export(qc_taxa_values_numeric)
export(rarify)
export(taxa_translate)
importFrom(rlang,.data)
14 changes: 13 additions & 1 deletion NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ NEWS

<!-- NEWS.md is generated from NEWS.Rmd. Please edit that file -->

#> Last Update: 2026-03-18 22:51:30.206983
#> Last Update: 2026-05-11 15:57:28.384427

# Version History

## Changes in version 1.2.4.9013 (2026-05-11)

- refactor: Rename qc_taxa_match_official to qc_taxa_names_match
- feature: Add qc_taxa_names_proof function
- Check for spelling issues
- feature: Add qc_taxa_phylo for checking master taxa list names
- refactor: Change names from distinct to parent in
qc_taxa_phylo\$unique_parent output
- data: Create example final id issues dataset
- docs: Document finalid_issues data
- fix: Fix metric x_Obs_CatoRhin in metric.values, Issue \#138

## Changes in version 1.2.4.9012 (2026-03-18)

- feature: Add qc_taxa_values_tolval function
Expand Down
14 changes: 13 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,22 @@ NEWS

<!-- NEWS.md is generated from NEWS.Rmd. Please edit that file -->

#> Last Update: 2026-03-18 22:51:30.206983
#> Last Update: 2026-05-11 15:57:28.384427

# Version History

## Changes in version 1.2.4.9013 (2026-05-11)

- refactor: Rename qc_taxa_match_official to qc_taxa_names_match
- feature: Add qc_taxa_names_proof function
- Check for spelling issues
- feature: Add qc_taxa_phylo for checking master taxa list names
- refactor: Change names from distinct to parent in
qc_taxa_phylo\$unique_parent output
- data: Create example final id issues dataset
- docs: Document finalid_issues data
- fix: Fix metric x_Obs_CatoRhin in metric.values, Issue \#138

## Changes in version 1.2.4.9012 (2026-03-18)

- feature: Add qc_taxa_values_tolval function
Expand Down
11 changes: 11 additions & 0 deletions NEWS.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ cat(paste0("Last Update: ",Sys.time()))

# Version History

## Changes in version 1.2.4.9013 (2026-05-11)

* refactor: Rename qc_taxa_match_official to qc_taxa_names_match
* feature: Add qc_taxa_names_proof function
+ Check for spelling issues
* feature: Add qc_taxa_phylo for checking master taxa list names
* refactor: Change names from distinct to parent in qc_taxa_phylo$unique_parent output
* data: Create example final id issues dataset
* docs: Document finalid_issues data
* fix: Fix metric x_Obs_CatoRhin in metric.values, Issue #138

## Changes in version 1.2.4.9012 (2026-03-18)

* feature: Add qc_taxa_values_tolval function
Expand Down
34 changes: 34 additions & 0 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -750,3 +750,37 @@
#' }
#' @source example data
"data_mmi_dev_small"
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# "data_taxa_names_issues" ----
#' \name{data_taxa_names_issues}
#' \alias{data_taxa_names_issues}
#' \docType{data}
#' \title{
#' A Capitalized Title for the Data Set
#' }
# \description{
#' %% ~~ A concise (1-5 lines) description of the dataset. ~~
#' }
#' \usage{data("data_taxa_names_issues")}
#' \format{
#' A data frame with 215 observations on the following 3 variables.
#' \describe{
#' \item{\code{Source}}{a character vector}
#' \item{\code{Issue}}{a character vector}
#' \item{\code{FinalID}}{a character vector}
#' }
#' }
#' \details{
#' %% ~~ If necessary, more details than the __description__ above ~~
#' }
#' \source{
#' %% ~~ reference to a publication or URL from which the data were obtained ~~
#' }
#' \references{
#' %% ~~ possibly secondary sources and usages ~~
#' }
#' \examples{
#' data(data_taxa_names_issues)
#' ## maybe str(data_taxa_names_issues) ; plot(data_taxa_names_issues) ...
#' }
#' \keyword{datasets}
27 changes: 21 additions & 6 deletions R/metric_values.R
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,7 @@ metric.values.bugs <- function(myDF
message(msg)
}## IF ~ verbose

## Logical ----
# Logical Columns to Logical
# Ensure in correct format, Access converts sometimes to 0, -1
# 2025-06-13
Expand All @@ -1260,6 +1261,7 @@ metric.values.bugs <- function(myDF
myDF[, i] <- as.logical(myDF[, i])
}## FOR ~ i ~ logical

## NonTarget ----
# Remove NonTarget Taxa (added back 20200715, missing since 20200224)
# Function fails if all NA (e.g., column was missing) (20200724)
if (verbose == TRUE) {
Expand All @@ -1283,6 +1285,7 @@ metric.values.bugs <- function(myDF
myDF <- dplyr::filter(myDF,
NONTARGET != TRUE | is.na(NONTARGET))

## ColNames to Upper ----
# # Convert columns to upper case (Phylo, FFG, Habit, Life_Cycle)
if (verbose == TRUE) {
debug_topic <- "Munging, text cols, toupper"
Expand Down Expand Up @@ -1334,7 +1337,7 @@ metric.values.bugs <- function(myDF
}## IF ~ verbose



## White Space ----
# Remove white space
myDF[, "HABIT"] <- gsub(" ","", myDF[, "HABIT"])
myDF[, "FFG"] <- gsub(" ","", myDF[, "FFG"])
Expand All @@ -1345,6 +1348,7 @@ metric.values.bugs <- function(myDF
myDF[, "ELEVATION_ATTR"] <- gsub(" ","", myDF[, "ELEVATION_ATTR"])
myDF[, "GRADIENT_ATTR"] <- gsub(" ","", myDF[, "GRADIENT_ATTR"])
myDF[, "WSAREA_ATTR"] <- gsub(" ","", myDF[, "WSAREA_ATTR"])
## Helper Cols ----
# code new columns
## match, any
myDF[, "HABIT_BU"] <- grepl("BU", myDF[, "HABIT"])
Expand All @@ -1366,6 +1370,7 @@ metric.values.bugs <- function(myDF
myDF[, "LC_MULTI"] <- grepl("MULTI", myDF[, "LIFE_CYCLE"])
myDF[, "LC_SEMI"] <- grepl("SEMI", myDF[, "LIFE_CYCLE"])
myDF[, "LC_UNI"] <- grepl("UNI", myDF[, "LIFE_CYCLE"])
myDF[, "FFG2_DD"] <- grepl("DD", myDF[, "FFG2"])
myDF[, "FFG2_PRE"] <- grepl("PR", myDF[, "FFG2"])
myDF[, "TI_STENOCOLD"] <- grepl("STENOC", myDF[, "THERMAL_INDICATOR"])
myDF[, "TI_COLD"] <- grepl("COLD", myDF[, "THERMAL_INDICATOR"])
Expand Down Expand Up @@ -1447,7 +1452,7 @@ metric.values.bugs <- function(myDF
# filter(row_number()<=5)


# Create Dominant N ####
## Dominant N ----
# Create df for Top N (without ties)
if (verbose == TRUE) {
debug_topic <- "Munging, Dom"
Expand Down Expand Up @@ -2595,12 +2600,19 @@ metric.values.bugs <- function(myDF
### FFG2 ####
# marine
## nt_ffg2
, nt_ffg2_deepdep = dplyr::n_distinct(TAXAID[EXCLUDE != TRUE
& FFG2_DD == TRUE]
, na.rm = TRUE)
, nt_ffg2_intface = NA
, nt_ffg2_subsurf = NA
## pi_ffg2
, pi_ffg2_deepdep = 100 * sum(N_TAXA[FFG2_DD == TRUE]
, na.rm = TRUE) / ni_total
, pi_ffg2_scavburr = NA
## pt_ffg2
# = conveyorbelt, interface, scavengerbrowser, subsurface, watercolumn, predator
, pi_ffg2_deepdep = 100 * nt_ffg2_deepdep / nt_total
# = conveyorbelt, interface, scavengerbrowser, subsurface,
# watercolumn, predator

### Habit ####
#(need to be wild card. that is, counts both CN,CB and CB as climber)
Expand Down Expand Up @@ -2762,6 +2774,7 @@ metric.values.bugs <- function(myDF

### Density ####
# Numbers per area sampled
, ni_m2 = NA

### Estuary-Marine ####
# Mixed in with other metrics
Expand Down Expand Up @@ -5156,12 +5169,14 @@ metric.values.fish <- function(myDF
# OR are really different and probably only applicable
# to a specific entity
#### Boise BCG
, x_Obs_CatoRhin <- as.integer(min(1, dplyr::n_distinct(TAXAID[EXCLUDE != TRUE
, x_Obs_CatoRhin = as.integer(min(1, dplyr::n_distinct(TAXAID[EXCLUDE != TRUE
& GENUS == "RHINICHTHYS"]
, na.rm = TRUE)) +
, na.rm = TRUE),
na.rm = TRUE) +
min(1, dplyr::n_distinct(TAXAID[EXCLUDE != TRUE
& FAMILY == "CATOSTOMIDAE"]
, na.rm = TRUE)))
, na.rm = TRUE),
na.rm = TRUE))
#### New Mexico Fish BCG
, nt_piscivore_BCG_att66s6t = dplyr::n_distinct(TAXAID[EXCLUDE != TRUE
& TROPHIC_PI == TRUE
Expand Down
File renamed without changes.
Loading
Loading