R/distance-depth.R
top_curves_to_points.Rd
pulling out data points from curves that are ranked highest based on quantile function.
top_curves_to_points( x, alpha, tidy_dm, quantile_func = distance_depth_function, x_names_df = NULL, ... )
x | list or grouped_df containing curves, with index ordering associated
with the |
---|---|
alpha | the proportion of curves to be removed before presenting all the points together. Takes value in [0, 1.0]. |
tidy_dm | a |
quantile_func | function to calculate quantiles via the distance_matrix,
we now expect this function to handle |
x_names_df | Only used when x is a list. Group structure associated with
the ordering of the items in the list |
... | additional parameters to be passed to the |
data frame from curves of the top values associated with the
quantile_func
See top_curves_to_points.list
and
top_curves_to_points.grouped_df
for more details and
commentary on expected parameters. top_curves_to_points.list
requires an additional parameter - x_names_df
.
library(dplyr) set.seed(1) random_data_list <- lapply(1:5, function(x){data.frame(matrix(rnorm(10), ncol = 2))}) dist_mat <- dist_matrix_innersq_direction(random_data_list, position = 1:2, verbose = FALSE) combined_points_list <- quantile_curves_to_points(random_data_list, alpha = .2, dist_mat) random_data_grouped <- random_data_list %>% do.call(rbind, .) %>% mutate(id = rep(1:5, each = 5)) %>% group_by(id) combined_points_grouped <- quantile_curves_to_points(random_data_grouped, alpha = .2, dist_mat)