easyRKT: Regional or Seasonal Kendall Test Helper Function

View source: R/easyRKT.R

easyRKTR Documentation

Regional or Seasonal Kendall Test Helper Function

Description

Takes a list of data.frames and pre-processes them for use with the rkt package to return a regional/seasonal Kendall p-value and estimated slope. Adds rows to data.frames in the list to make each the same length and creates a blocking variable for each data.frame. Can factor covariables and correlation between blocks as well as deal with multiple data points in the same time period, but the underlying function rkt::rkt does not currently handle covariables.

Usage

easyRKT(
  data,
  valuesColumn,
  timeColumn,
  covariable = "none",
  correlate.correct = F,
  rep = "e"
)

Arguments

data

A list of data.frames to test, with each data.frame representing one station (for regional Kendall) or season (for seasonal Kendall). Data.frames must contain a column of type numeric with the data to be analyzed (valuesColumn) and a matching integer column representing regular interval (timeColumn). Data frames in a list can be of different lengths but must have identical column names.

valuesColumn

The column name of the values to be tested.

timeColumn

The column name of the date/time representative integer values.

covariable

(optional) A column in the data.frames representing a covariable. Refer to ?rkt::rkt for more information.

correlate.correct

Boolean T/F. If T, correction for correlation between blocks is performed. Refer to ?rkt::rkt for more information.

rep

What to do with data sharing the same date. Set to "a" to average, "m" for median. Any other value results in error if two or more data points share a date. As per rkt::rkt.

Value

An object of type "rkt" with the Kendall Tau, S, and variance of S, a 2-sided p-value, and a seasonal/regional Kendall slope.


YukonWRB/WRBTrends documentation built on Oct. 26, 2022, 6:36 a.m.