View source: R/tidyConvertToProbabilities.R
probabilitiesFromDiscrete | R Documentation |
The purpose of this is to calculate the probabilities of events from discrete data. This function is useful when you have either a set of observations of its occurrence, containing non-unique x events, or you have a counts of their events where each row has the type of observation of X=x and the countVar column contains the counts of the event.
probabilitiesFromDiscrete(df, discreteVars, sampleVars, countVar = NULL)
df |
a dataframe containing columns defining class of observations of discrete variable X and either one row per observation, or a count of observations for each of the observed values of X. df may be grouped and in which case the grouping defines the top level - usually this is the feature under investigation |
discreteVars |
the datatable column(s) defining the class of the discrete variable observed quoted by vars(...) |
sampleVars |
the datatable column(s) defining the id of each sample the observation quoted by vars(...) |
countVar |
the datatable column containing the observed frequency of the event X. If this is missing the row count will be used instead. |
A summary datatable with possible values of X and the total (N), the total count of that group (N_x) the probability (p_x), and self information (I_x) associated with the value of X
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.