R/containment-and-band-creation.R
grab_top_depth_filaments.Rd
similar to depth_curves_to_points.grouped_df
grab_top_depth_filaments( grouped_df, data_columns = NULL, filament_depth_function = filament_distance_depth, conf_level = 0.95, .remove_group = TRUE )
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 |
filament_depth_function | function to calculate depth relative to the
filaments in the |
conf_level | proportion of filaments to keep |
.remove_group | boolean (default true). Should the output keep the grouping columns or just havd data points? |
updated grouped_df
with only the top depth filaments
library(dplyr) top_filaments <- EpiCompare::pomp_df %>% group_by(.id) %>% filter(.id <= 10) %>% grab_top_depth_filaments(data_columns =c("S","I","R"), conf_level = .5) # note that the below doesn't contain all filaments - as some have 0 depth all_but_extreme_filaments <- EpiCompare::pomp_df %>% group_by(.id) %>% filter(.id <= 10) %>% grab_top_depth_filaments(data_columns = c("S","I","R"), conf_level = 1)