classCountFromGroup: Helper function to calculate observed class counts of...

View source: R/tidyConvertToProbabilities.R

classCountFromGroupR Documentation

Helper function to calculate observed class counts of discrete variable X in grouped data in a tidy friendly manner. Class counts are needed for certain corrections to the entropy and

Description

Helper function to calculate observed class counts of discrete variable X in grouped data in a tidy friendly manner. Class counts are needed for certain corrections to the entropy and

Usage

classCountFromGroup(df, groupVars, summarise = FALSE)

Arguments

df

a dataframe containing 2 columns defining class of event X and class of event Y and either one row per event, or a count of observations, for each class combination. df may also be grouped and in which case the grouping is preserved in the result.

groupVars

the datatable column(s) defining the class of the observation quoted by vars(...)

summarise

- return a mutated (FALSE) or summarised (TRUE) result of the df

countVar

the datatable column containing the observed frequency combination of event XY. If this is missing the row count will be used instead

Value

A mutated datatable with the count of possible values of X as C (repeated for every observation of X) and the corresponding maximum entropy of the source (max_H)


terminological/tidy-info-stats documentation built on Nov. 19, 2022, 11:23 p.m.