Learn R Programming

pdt (version 0.0.2)

insert_NA_and_try_to_shift: insert_NA_and_try_to_shift

Description

Makes the input time series equidistant. This is recommended before performing a permutation distancing test. This function first inserts NA's for missing x_values, then it tries to shift double value to previous or next NA's, finally it aggregates the remaining identical x_values.

Usage

insert_NA_and_try_to_shift(x, x_values, y)

Value

List with the modified x, x_values, y: x = factor vector with conditions or phases (e.g., "A" and "B"). x_values = (optional) vector with distance (time markers) between observations. y = vector with observed values.

Arguments

x

factor vector to indicate conditions or phases (e.g., "A" and "B")

x_values

numerical vector with distance (time markers) between observations

y

numeric vector with the observed y-values

Examples

Run this code
pdt::insert_NA_and_try_to_shift(as.factor(c("A","A","A","B","B","B")),
  c(1,2,4,5,6,8), c(1.1,3.2,5.3,7.1,8.3,9.8))

Run the code above in your browser using DataLab