cut_breaks_as_intervals: Wrapper for cut

Description Usage Arguments Value See Also Examples

View source: R/complex_functions.R

Description

In this wrapper function for the known cut function, the breaks vector need not be supplied directly, instead, for every break, an interval is supplied and the function optimizes the choice of the breakpoint by chosing a local minimum of the distribution.

Usage

1
2
3
4
5
6
7
8
cut_breaks_as_intervals(
  in_vector,
  in_outlier_cutoffs = c(0, 3000),
  in_cutoff_ranges_list = list(c(60, 69), c(25, 32)),
  in_labels = c("late", "intermediate", "early"),
  in_name = "",
  output_path = NULL
)

Arguments

in_vector

Vector of numerical continuously distributed input

in_outlier_cutoffs

Interval specifyinf the upper and lower bounds of the range to be considered

in_cutoff_ranges_list

List if intervals in which the cutoffs for cut have to be optimized.

in_labels

Labels assigned to the strata or factors returned

in_name

String specifying the name of the quantity analyzed (and plotted on the x-axis of the figure to be created).

output_path

Path where the figure produced by the density function should be stored if non-NULL.

Value

A list with entries category_vector, and density_plot and cutoffs

See Also

cut

density

Examples

1
2
3
4
5
6
7
8
 data(lymphoma_test)
 lymphoma_test_df$random_norm <- rnorm(dim(lymphoma_test_df)[1])
 temp_list <- cut_breaks_as_intervals(
   lymphoma_test_df$random_norm,
   in_outlier_cutoffs=c(-4,4),
   in_cutoff_ranges_list=list(c(-2.5,-1.5),c(0.5,1.5)),
   in_labels=c("small","intermediate","big"))
  temp_list$density_plot

slw287r/yapsa documentation built on June 7, 2020, 12:46 a.m.