unshiftdata: Inverse of shiftdata

View source: R/unshiftdata.R

unshiftdataR Documentation

Inverse of shiftdata

Description

Reverse what has been done by shiftdata().

Usage

unshiftdata(sd)

Arguments

sd

A list of objects named x, perm, and nshifts, as returned by shiftdata()

Details

unshiftdata restores the orientation of the data that was shifted with shiftdata. The permutation vector is given by perm, and nshifts is the number of shifts that was returned from shiftdata().

unshiftdata is meant to be used in tandem with shiftdata. These functions are useful for creating functions that work along a certain dimension, like filter, goertzel, sgolayfilt, and sosfilt. These functions are useful for creating functions that work along a certain dimension, like filter, sgolayfilt, and sosfilt.

Value

Array with the same values and dimensions as passed to a previous call to shiftdata.

Author(s)

Georgios Ouzounis, ouzounis_georgios@hotmail.com.
Conversion to R by Geert van Boxtel, G.J.M.vanBoxtel@gmail.com.

See Also

shiftdata

Examples


## create a 3x3 magic square
x <- pracma::magic(3)
## Shift the matrix x to work along the second dimension.
## The permutation vector, perm, and the number of shifts, nshifts,
## are returned along with the shifted matrix.
sd <- shiftdata(x, 2)

## Shift the matrix back to its original shape.
y <- unshiftdata(sd)

## Rearrange Array to Operate on First Nonsingleton Dimension
x <- 1:5
sd <- shiftdata(x)
y <- unshiftdata(sd)


gsignal documentation built on Sept. 12, 2024, 6:27 a.m.