Learn R Programming

transx

Univariate time series operations that follow an opinionated design. The main principle of transx is to keep the number of observations the same. Operations that reduce this number have to fill the observations gap.

Design Principles

  • The input and the output will always be a numeric vector.
  • The output retains the same length as the input.
  • Uses a filling logic, where fill is used to keep the length of vector identical.

Optional:

  • na.rm: Which setsna.rm = TRUE by default when needed to.
  • keep.attrs: Which after manipulations the new series would retain the same attributes.
  • display: Display informative message for the transformation procedure.

Installation

You can install the development version from Github.

remotes::install_github("transx")

Usage

This is a basic example with lagged and leading values. fill can be achieved either by value or by function. The function can be a build-in function such as mean, or median, that fill-in by a single values, or it can be of the fill_* family such as fill_locf and fill_nocb that consider the location of the observations before performing the filling.

library(transx)

x <- c(5,3,2,2,5)
lagx(x)
#> [1] NA  5  3  2  2
lagx(x, fill = 1)
#> [1] 1 5 3 2 2
lagx(x, fill = mean)
#> [1] 3 5 3 2 2
lagx(x, fill = fill_nocb)
#> [1] 5 5 3 2 2

Code of Conduct

Please note that the transx project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

Copy Link

Version

Install

install.packages('transx')

Monthly Downloads

194

Version

0.0.1

License

GPL-3

Issues

Pull Requests

Stars

Forks

Maintainer

Kostas Vasilopoulos

Last Published

November 27th, 2020

Functions in transx (0.0.1)

dtrend

Deterministic Trend
filter_bw

Butterworth Filter
out_score_z

Detect outliers with zscore
gmean

Geometric Mean value
plotx

Plotting wrapper around plot.default
pow

nth Power Transformation
filter_tr

Trigonometric regression Filter
filter_hamilton

Hamilton Filter
select_lambda

Selecting lambda
filter_hp

Hodrick-Prescot Filter
filter_cf

Christiano-Fitzgerald Filter
skewness

Skewness/Kurtosis Value
out_iqr

Detect outliers with Tukey's method
leadx-lagx

Compute lagged or leading values
rebase

Change the base year
out_threshold

Detect outliers with upper and lower threshold
out_score_zrob

Detect outliers Iglewicz and Hoaglin (1993) robust z-score method
root

nth Root Transformation
out_winsorise

Winsorize
pow_tukey

Tukey Transformations Transformations
pow_yj

Yeo and Johnson(2000) Transformations
score

Score transformation
scale_range

Rescale
modex

Mode value
pow_boxcox

Box-Cox Transformations
std

Standarization
pow_manly

Manly(1971) Transformations
out_pt

Detect outliers with Percentiles
filter_bk

Baxter-King Filter
fill_spline

Fill with "cubic spline interpolation"
fill_linear

Fill with "linear approximation"
fill_nocb

Fill with "Next observation carried backwards"
fill_locf

Fill with "Last Observation Carried Forward"
demean-demedian

Removes measure of centrality from the series
diffx-rdiffx-ldiffx

Compute lagged differnces