marginal | R Documentation |
Calculates marginal probabilities or counts of all selected columns. Option to include row-weights.
marginal(data, cols, weight, stat = "prob", tidy = TRUE)
data |
A data frame. |
cols |
Columns on which to operate, tidy-select compatible. Columns must
contain only 1s and 0s (or |
weight |
An optional column of row-weights. |
stat |
Either |
tidy |
Logical, whether or not to return results in tidy format.
Default |
Returns either a vector (if tidy = FALSE
), or a tibble in long
form of the probabilities or counts of "A."
marginal(
data = FoodSample,
cols = Bisque:PorkChop,
weight = weight,
tidy = TRUE
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.