Skip to content

Commit

Permalink
fix: uses stats::sd()
Browse files Browse the repository at this point in the history
  • Loading branch information
kellijohnson-NOAA authored and k-doering-NOAA committed Mar 28, 2024
1 parent 89c9a0b commit 4952dcd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions R/example_perf_metrics.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ get_avg_catch <- function(datfile, yrs) {
#' }
get_catch_sd <- function(datfile, yrs) {
dat <- r4ss::SS_readdat(datfile, verbose = FALSE)
catch_var <- sd(dat[["catch"]][dat[["catch"]][["year"]] %in% yrs, "catch"])
catch_var <- stats::sd(dat[["catch"]][dat[["catch"]][["year"]] %in% yrs, "catch"])
}

#' Example Performance Metric: Calculate the coefficient of variation of catch
Expand All @@ -72,7 +72,7 @@ get_catch_sd <- function(datfile, yrs) {
get_catch_cv <- function(datfile, yrs) {
dat <- r4ss::SS_readdat(datfile, verbose = FALSE)
catch <- dat[["catch"]][dat[["catch"]][["year"]] %in% yrs, "catch"]
catch_var <- sd(catch) / mean(catch)
catch_var <- stats::sd(catch) / mean(catch)
}

#' Example Performance Metric: calculate the average SSB over a range of years
Expand Down

0 comments on commit 4952dcd

Please sign in to comment.