ts_trimfill: Trim or Fill Vectors

ts_trimfillR Documentation

Trim or Fill Vectors

Description

Trim the largest vector by cutting it, or filling it with NA. Fill the shortest vector with padding.

Usage

ts_trimfill(
  x,
  y,
  action = c("fill", "trim.cut", "trim.NA")[1],
  type = c("end", "center", "front")[1],
  padding = 0,
  silent = TRUE
)

Arguments

x

A numeric vector

y

A numeric vector

action

Use "fill" to fill the shortest vector with padding (default); "trim.cut" to trim the longest vector to the length of the shortest; "trim.NA" to fill the longest vector with NA. This is a shortcut for running action = "trim.cut" with padding=NA, which can be useful if one wants to match the shortest series, but preserve the original length of largest vector.

type

Should trimming or filling take place at the "end" (default), or "front" of the vector? The option "center" will try to distribute trimming by NA or filling by padding evenly across the front and end of the vector.

padding

A value to use for padding (default = 0)

silent

Run silent-ish

Value

A list with two vectors of equal length.

Author(s)

Fred Hasselman

See Also

il_mi

Other Time series operations: ts_center(), ts_changeindex(), ts_checkfix(), ts_detrend(), ts_diff(), ts_discrete(), ts_duration(), ts_embed(), ts_integrate(), ts_levels(), ts_peaks(), ts_permtest_block(), ts_permtest_transmat(), ts_rasterize(), ts_sd(), ts_slice(), ts_standardise(), ts_sumorder(), ts_symbolic(), ts_windower()

Other Time series operations: ts_center(), ts_changeindex(), ts_checkfix(), ts_detrend(), ts_diff(), ts_discrete(), ts_duration(), ts_embed(), ts_integrate(), ts_levels(), ts_peaks(), ts_permtest_block(), ts_permtest_transmat(), ts_rasterize(), ts_sd(), ts_slice(), ts_standardise(), ts_sumorder(), ts_symbolic(), ts_windower()


FredHasselman/casnet documentation built on March 10, 2024, 8:23 a.m.