0th

Percentile

Given a data frame and the names of variable, doubles the data frame for each variable with a new category "All" (or optionally "Combined"). A new variable .marginal. is added to the resulting data frame, with value "" if the observation is an original one, and with value equal to the names of the variable being marginalized (separated by commas) otherwise.

Keywords
manip, utilities
##### Usage
addMarginal(data, ..., label = "All", margloc=c('last', 'first'))
##### Arguments
data
a data frame
...
a list of names of variables to marginalize
label
category name for added marginal observations
margloc
location for marginal category within factor variable specifying categories. Set to "first" to override the default - to put a category with value label as the first category.
##### Aliases
d <- expand.grid(sex=c('female', 'male'), country=c('US', 'Romania'),