multivariate_process_timeseries: Helper function to prepare raw data for analysis

View source: R/multivariate_process_timeseries.R

multivariate_process_timeseriesR Documentation

Helper function to prepare raw data for analysis

Description

Processes raw data in such a way that it can be directly inputted to the multivariate_rythm_analysis function.

Usage

multivariate_process_timeseries(df = NULL, sampling_rate = NULL, window_size_in_days = 3, window_step_in_days = 1, smooth_data = TRUE, detrend_data = FALSE)

Arguments

df

(required) A data.frame where the first column is a POSIXct object and the rest are independent measurement values.

sampling_rate

(required) A character string indicating the sampling rate of the data. Examples: '30 minutes', '1 hour', '4 seconds', '100 days'.

window_size_in_days

(default=3) a numeric indicating the width of the window size in day units.

window_step_in_days

(default=1) a numeric indicating the amount of day by which to move the window in day units.

detrend_data

Logical. If TRUE (default) will detrend the data. If FALSE measurement values won't be detrended. If both, detrend_data and smooth_data are TRUE, the detrending will run over the smoothed data.

butterworth

Logical. If TRUE (default) will apply a butterworth filter to the measurement values using a moving average. If FALSE measurement values won't be filtered.

f_low

Frequency for the low pass filter. Default = 1/4.

f_high

Frequency for the high pass filter. Default = 1/72.

order

filter order. Default = 2.

smoothing_n

A numeric which indicated the amount of bins over which to run the smoothing average. Default = 4.

plot

logical. If TRUE (default) plots the filtered data over the raw data. If FALSE, does not plot.

movavg

Logical. If TRUE will smooth the measurement values useing a moving average. If FALSE (default) measurement values won't be smoothed.

Value

A named list of data.frames containing the output of [process_timeseries()] for each measurement value.

Examples


processed_data <- multivariate_process_timeseries(df = raw_data,
sampling_rate = "30 min", window_size_in_days = 3,
window_step_in_days = 1, smooth_data = TRUE,
detrend_data = TRUE)


edpclau/circadian-dynamics documentation built on Aug. 25, 2023, 12:18 p.m.