qtable_: qtable

Description Usage Arguments Value Author(s) Examples

View source: R/qtable.R

Description

Generating "quick" tables for one or more variables (does not support mixed types). By default qtable generates proportions for factor and character vectors, means for numeric and integer, and min/max for Date (including POSIX) vectors. It always includes the number of observations for each variable. When producing wide tables, group counts are separate with /.

Usage

1
2
qtable_(df, vars, groups = NULL, weight = NULL, margin = TRUE,
  margin_name = NULL, wide = TRUE)

Arguments

df

A data.frame or data.table.

vars

The variables to aggregate, as a character vector.

groups

Variables to group by during aggregation.

weight

Name of a variable to weight by. Only used when margin = TRUE.

margin

If TRUE (the default), the first group will include a "Total".

margin_name

Optional: Give the margin a different name from "Total".

wide

Should a long or a wide table be returned? Wide tables spread levels for factor and unique values for character. For a single numeric, the last group is used, while multiple numeric will be spread by variable names.

Value

A data.frame or data.table with the additional class qtable.

Author(s)

Kristian D. Olsen

Examples

1
# TODO

itsdalmo/tabulR documentation built on May 18, 2019, 7:11 a.m.