crosstabs produces Toplines (one-way frequency tables) or Crosstabs (cross tabulations) summaries of a Cruch dataset.

crosstabs(
  dataset,
  vars = names(dataset),
  weight = crunch::weight(dataset),
  banner = NULL,
  codebook = FALSE,
  include_numeric = FALSE,
  include_datetime = FALSE,
  include_verbatims = FALSE,
  num_verbatims = 10,
  include_original_weighted = TRUE
)

toplines(
  dataset,
  vars = names(dataset),
  weight = crunch::weight(dataset),
  banner = NULL,
  codebook = FALSE,
  include_numeric = FALSE,
  include_datetime = FALSE,
  include_verbatims = FALSE,
  num_verbatims = 10,
  include_original_weighted = TRUE
)

Arguments

dataset

A Crunch dataset.

vars

An optional vector of aliases of the non-hidden variables that shoulds be used. Defaults to all non-hidden variables.

weight

The alias of a numeric variable that should be used for data weighting. Alternatively a named list where the name is the alias of the weight and the contents of the list component are a character vector of aliases to which that weight should apply. Defaults to current weight variable. For unweighted, set to NULL

banner

An optional object of class Banner that should be used to generate a Crosstabs summary. Defaults to NULL - a Toplines summary is produced and returned.

codebook

If TRUE, codebook data summaries are prepared. Defaults to FALSE.

include_numeric

Logical. Should we include numeric questions? Defaults to FALSE. Implemented for Toplines only.

include_datetime

Logical. Should we include date time questions? Defaults to FALSE. Implemented for Toplines only.

include_verbatims

Logical. Should we include a sample text varaibles? Defaults to FALSE. Implemented for Toplines only.

num_verbatims

An integer identifying the number of examples to extract from a text variable. Defaults to 10. Implemented for Toplines only.

include_original_weighted

Logical. When providing list of weights to apply, should we include the default weighted vars? Defaults to TRUE.

Value

A Toplines (when no banner is provided) or Crosstabs (when a banner is provided) summary of the input dataset.

Functions

  • toplines(): An alias for crosstabs

Examples

if (FALSE) { toplines_summary <- crosstabs(crunch_dataset, weight = "weight") crosstabs_summary <- crosstabs(crunch_dataset, vars = c("alias1", "alias2"), weight = "weight", banner = banner_object ) }