View source: R/peekds_generate_aoi.R
ds.resample_times | R Documentation |
Resampling is done by the following steps:
ds.resample_times(df_table, table_type)
df_table |
to-be-resampled dataframe with t, aoi/xy values, trial_id and administration_id |
table_type |
table name, can only be "aoi_timepoints" or "xy_timepoints" |
1. iterate through every trial for every administration
2. create desired timepoint sequence with equal spacing according to pre-specified SAMPLE_RATE parameter
3. use approxfun to interpolate given data points to align with desired timepoint sequence "constant" interpolation method is used for AOI timepoints; "linear" interpolation method is used for xy timepoints; for more details on approxfun, please see: https://stat.ethz.ch/R-manual/R-devel/library/stats/html/approxfun.html
4. after resampling, bind resampled dataframes back together and re-assign aoi_timepoint_id
df_out with resampled time, xy or aoi value rows
## Not run:
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")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.