Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

add_margins

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.


reshape2

Flexibly Reshape Data: A Reboot of the Reshape Package

v1.4.4
MIT + file LICENSE
Authors
Hadley Wickham <h.wickham@gmail.com>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.