Downsample frequency to reduce number of samples and data size
Source:R/clean_and_downsample.R
downsample_time_data.RdThis 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"))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')
#> Calculating mean pupil size in each timebin