Learn R Programming

plyr (version 1.1)

margins: Figure out margining variables.

Description

Figure out margining variables. Given the variables that form the rows and columns, and a set of desired margins, works out which ones are possible. Variables that can't be margined over are dropped silently.

Usage

margins(rows, cols, margins)

Arguments

col
a character vector of column names
row
a character vector of row names
margins
a character vector of variable names to margin over. Can be any variable name in col or row, "grand_row" or "grand_col". If TRUE will compute all possible margins.

Value

  • list of margining combinations, or NULL if none. These are the combinations of variables that should have their values set to `(all)`