Compress filaments to filaments with the same number of points (equally linearly space compared to original filament definition)

filament_compression(grouped_df, data_columns = NULL, number_points = 13)

Arguments

grouped_df

grouped_df data.frame object (assumed rows per filament are ordered) - grouped per each filament

data_columns

columns of data.frame that relate to the filament's coordinates in euclidean space. The input should look like something like c(S,I,R) or c("S", "I", "R"). If the input is NULL this function will treat this like all non-group columns.

number_points

integer number of points for each filament to be compressed to

Value

updated grouped_df with new rows so that each filament has the same number of points.

Examples

library(dplyr) t13compression <- EpiCompare::pomp_sir %>% arrange(time) %>% # just to be safe select(-H, -cases, -time) %>% filter(.id <= 5) %>% group_by(.id) %>% filament_compression() t9compression <- EpiCompare::pomp_sir %>% filter(.id <= 5) %>% group_by(.id) %>% filament_compression(data_columns = c("S","I","R"), number_points = 9)