smooth_and_detrend: Smooth and/or Detrend Data by Windows

View source: R/smooth_detrend_by_windows_2.R

smooth_and_detrendR Documentation

Smooth and/or Detrend Data by Windows

Description

Smooth and/or Detrend Data by Windows

Usage

smooth_detrend_by_windows(df = NULL, smooth_data = TRUE, detrend_data = TRUE, windows = NULL, values = NULL)

Arguments

df

a data.frame with 2 columns. The first column must be the windows. The second column the values to process.

smooth_data

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

binning_n

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

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.

windows

Optional if a data.frame is supplied. A vector with the windows.

values

Optional if a data.frame is supplied. A vector of values from a mesurement.

Value

A data.frame conatining: /n

window A vector with the windows. /n values The raw measurement values. /n smoothed A column with the smoothed data. /n detrended A column with the detrended data. /n smoothed_and_detrended A column with data that's been both smoothed and detrended.

Examples

smoothed_data <- smooth_detrend_by_windows(df = windowed_data, smooth_data = TRUE, detrend_data = FALSE)


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