calcLongTermTrendSimple: calcLongTermTrendSimple

View source: R/Module_calcLongTermTrendSimple.R

calcLongTermTrendSimpleR Documentation

calcLongTermTrendSimple

Description

this function just does a basic long-term trend calculation on a single vector. calcLongTermTrend() applies the same basic calculation iteratively for each year and stock in a data frame (Year X Stock) using only data prior to that year.

Usage

calcLongTermTrendSimple(
  vec.in,
  gen.in = 4,
  min.lt.yrs = 20,
  avg.type = "geomean",
  tracing = FALSE,
  recent.excl = FALSE
)

Arguments

vec.in

a vector of raw values. NA are possible, but will result in NA trend for any recent time window that includes one or more NA

gen.in

use the last gen.in values for the "recent" avg

min.lt.yrs

return NA if don't have at least this many years to calculate longterm avg

avg.type

"mean","geomean", or "median"

recent.excl

if TRUE, then don't use the values from the recent gen as part of the LT avg

Examples

calcLongTermTrendSimple(vec.in = exampleData$Stock1, gen.in = 4,min.lt.yrs = 20,
avg.type = "geomean", tracing=FALSE,recent.excl = FALSE)

Pacific-salmon-assess/WSP-Metrics-Pkg documentation built on July 16, 2025, 1:46 p.m.