Learn R Programming

percentiles (version 0.2.2)

Stratified_percentile_calculator_generator: R6 Class representing a compund of data and methods used to calculate stratified percentiles

Description

R6 Class representing a compund of data and methods used to calculate stratified percentiles

R6 Class representing a compund of data and methods used to calculate stratified percentiles

Arguments

Active bindings

raw_data

Return the data.frame originally handed to the object

result_data

Return the environment containing a data.frame (<U+00A7>data) containing results of current hierarchy

sub_results

Return the named list with Stratified_percentile_calculator_generator objects for recursive stacking

Methods

Public methods

Method new()

Create a new Stratified_percentile_calculator object.

Usage

Stratified_percentile_calculator_generator$new(
  raw_data = NULL,
  result_data = new.env(),
  current_stratification_characteristic = NULL,
  remaining_stratification_characteristics = NULL,
  value_column = NULL,
  output_column = NULL,
  use.na = FALSE
)

Arguments

raw_data

data.frame to perform calculation/stratification on.

result_data

environment containing $data, a data.frame with the current state of results.

current_stratification_characteristic

named list with column name and levels of characteristic to stratify by.

remaining_stratification_characteristics

named list with column names and levels of characteristics to stratify by.

value_column

character column with values to calculate percentiles on

output_column

character column to write calculated percentile values to

use.na

logical indicating whether or not NA/non-listed stratification values should be included as a separate group

Returns

A new `Stratified_percentile_calculator` object.

Method divide_and_calculate()

recursively calculate stratified percentiles on data.frame Updates following private fields: - ..result_data$data - ::sub_results - ..current_stratification_characteristic - ..remaining_stratification_characteristics

Usage

Stratified_percentile_calculator_generator$divide_and_calculate()

Returns

void, but updates ..result_data field

Method clone()

The objects of this class are cloneable with this method.

Usage

Stratified_percentile_calculator_generator$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

A calculator has: - raw_data representing the data.frame passed in for calculation - result_data an environment containing the result data.frame $data, shared with - sub_results representing subordinate steps in recursive calculation process