This function resample times to be consistent across labs.
Source:R/ds_times.R
ds.resample_times.RdResampling is done by the following steps:
Details
iterate through every trial for every administration
create desired timepoint sequence with equal spacing according to pre-specified SAMPLE_RATE parameter
use
stats::approx()with "constant" interpolation, for AOI and xy timepoints alike, to give each new timepoint the value of the last sample at or before itafter resampling, bind resampled dataframes back together and re-assign aoi_timepoint_id or xy_timepoint_id
Examples
if (FALSE) { # \dontrun{
dir_datasets <- "testdataset" # local datasets dir
lab_dataset_id <- "pomper_saffran_2016"
dir_csv <- file.path(dir_datasets, lab_dataset_id, "processed_data")
table_type <- "aoi_timepoints"
file_csv <- file.path(dir_csv, paste0(table_type, '.csv'))
df_table <- utils::read.csv(file_csv)
df_resampled <- ds.resample_times(df_table, table_type = "aoi_timepoints")
} # }