banner: Create an object of class 'Banner'

View source: R/banner.R

bannerR Documentation

Create an object of class Banner

Description

Create an object of class Banner

Usage

banner(dataset, vars, labels = NULL, recodes = NULL)

Arguments

dataset

A Crunch dataset.

vars

A named list of vectors of aliases of the variables that should constitute the banner object. These should be categorical (and typically hidden) variables present in the dataset.

labels

An optional named list of labels, where names are variables' aliases (present in the vars parameter) and values are the labels that should be used in the report. Defaults to NULL - variables names are used.

recodes

An optional named list of categories recodes (the syntax is similar to the one used in the recode function in the R dplyr package). Use NA to exclude categories. Not listed categories will be left unchanged. Use .default to replace all not listed categories. See examples for details. Defaults to NULL - categories are not modified.

Value

An object of class Banner.

Examples

## Not run: 
banner_data <- banner(crunch_dataset,
  vars = list(subBanner1 = c("alias1", "alias2"), subBanner2 = c("alias3")),
  labels = c(alias1 = "var1 label", alias2 = "var2 label"),
  recodes = list(
    alias1 = list(cat1a = "new cat1a", cat1b = NA),
    alias2 = list(cat2a = "new cat2a", cat2b = "new cat2b", .default = NA)
  )
)

## End(Not run)

Crunch-io/crunchtabs documentation built on Jan. 31, 2023, 12:14 p.m.