rollPAM: Rolling window

View source: R/rollPAM.R

rollPAMR Documentation

Rolling window

Description

This function merges all the data to a given output resolution and then progresses along the timeseries and creates summary statistics within a pre-defined time window. Can interpolate or not. Interpolations is only recommended if the analysis cannot handle NAs and if the window is smaller than the data (e.g. magnetic) with the worst temporal resolution

Usage

rollPAM(dta, interp = TRUE, resolution_out = 15, window = 120, units = "mins")

Arguments

dta

PAM data to be used in the analysis

interp

By default TRUE. Whether or not to interpolate NAs in dataset that the rollapply is used on.

resolution_out

Temporal resolution of output dataset. By defaukt 15 mins. Must be in minutes unless the units are changed

window

Window over which to apply the rolling window. By defaukt 120 mins. Equivalent to zoo::rollapply(,width = window,) Must be in minutes unless the units are changed

units

By default"mins", but also supports "hours" and "secs"

Value

a dataframe of derived metrics including the median, standard deviation, minimum, maximum, cumulative difference and range over the period

Examples


#data(swift)
#PAM_data = swift

## crop the data to get rid of no good periods
#start = as.POSIXct("2016-09-01","%Y-%m-%d", tz="UTC")
#end = as.POSIXct("2017-04-21","%Y-%m-%d", tz="UTC")
#PAM_data = cutPAM(PAM_data, start, end)

#TOclassify = rollPAM(dta = list(pressure = PAM_data$pressure,
#                                acceleration = PAM_data$acceleration),
#                     resolution_out = 60 ,
#                     window = 24*60)


KiranLDA/PAMLr documentation built on March 6, 2023, 1:40 p.m.