Last data update: 2014.03.03

R: Add margins to a data frame.
add_marginsR Documentation

Add margins to a data frame.

Description

Rownames are silently stripped. All margining variables will be converted to factors.

Usage

add_margins(df, vars, margins = TRUE)

Arguments

df

input data frame

vars

a list of character vectors giving the variables in each dimension

margins

a character vector of variable names to compute margins for. TRUE will compute all possible margins.

Results