View source: R/Module_calcLongTermTrendSimple.R
calcLongTermTrendSimple | R Documentation |
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.
calcLongTermTrendSimple(
vec.in,
gen.in = 4,
min.lt.yrs = 20,
avg.type = "geomean",
tracing = FALSE,
recent.excl = FALSE
)
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 |
calcLongTermTrendSimple(vec.in = exampleData$Stock1, gen.in = 4,min.lt.yrs = 20,
avg.type = "geomean", tracing=FALSE,recent.excl = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.