downsample_time_data: Downsample frequency to reduce number of samples and data...

View source: R/clean_and_downsample.R

downsample_time_dataR Documentation

Downsample frequency to reduce number of samples and data size

Description

This function is useful if you were sampling at a very high frequency (eg 500Hz) causing the data size to be hard to manage, and high autocorrelation. Careful decisions should be made about the time bin size and appropriateness of this function, with respect to the data type.

Usage

downsample_time_data(data, pupil, timebin_size, option = c("mean", "median"))

Arguments

data

your data of class PupillometryR

pupil

a column name denoting pupil size

timebin_size

the size of the new timebin you wish to use

option

what should be calculated in each timebin - mean or median. Defaults to mean.

Value

A downsampled dataframe of class PupillometryR

Examples

data(pupil_data)
Sdata <- make_pupillometryr_data(data = pupil_data,
subject = ID,
trial = Trial,
time = Time,
condition = Type)
new_data <- downsample_time_data(data = Sdata,
pupil = LPupil,
timebin_size = 50,
option = 'mean')

PupillometryR documentation built on Sept. 15, 2023, 5:13 p.m.