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

Description Usage Arguments Value Examples

View source: R/clean_and_downsample.R

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

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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')

samhforbes/PupillometryR documentation built on Sept. 14, 2021, 11:50 p.m.