qtable_.Survey: Using qtable_ with a Survey

Description Usage Arguments Details Author(s) Examples

View source: R/tables.R

Description

This is a S3 method for qtable. In addition to the standard functionality in qtable, it also replaces variable names with their label ("var: label") if a label exists. This is done for column names, and for the variable column in a long table (wide = FALSE). When margin = TRUE, the table will use the "average" from set_translation for the margin.

Usage

1
2
3
## S3 method for class 'Survey'
qtable_(df, vars, groups = NULL, weight = NULL,
  margin = TRUE, margin_name = NULL, wide = TRUE)

Arguments

df

A Survey.

vars

The variables to aggregate, as a character vector.

groups

Variables to group by during aggregation.

weight

Name of variable to weight by. Set this to TRUE to use the 'weight' association in the Survey.

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.

Details

If you only want the regular qtable functionality, the recommended way is to just call qtable on the survey data itself (qtable(x$data) instead of qtable(x)).

Author(s)

Kristian D. Olsen

Examples

1

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