profile_table_2: Creates a list of data.frame elements. Each data.frame...

View source: R/profile_table.R

profile_table_2R Documentation

Creates a list of data.frame elements. Each data.frame consists of 4 sets of cross tables. These are raw count, col %, row % and col % index tables. There will be as many list elements as there are banner_vars.

Description

Creates a list of data.frame elements. Each data.frame consists of 4 sets of cross tables. These are raw count, col %, row % and col % index tables. There will be as many list elements as there are banner_vars.

Usage

profile_table_2(
  df,
  category_vars = NULL,
  numeric_vars = NULL,
  weight_var = NULL,
  banner_vars,
  table_labels
)

Arguments

df

data.frame of input variables

category_vars

variables that are to be treated as factors in the table output. Will produce counts for each value for each variable. If weight_var is provided, will produce weighted counts.

numeric_vars

variables that are to be treated as numeric in the table output. Will produce means for each variable. if weight_var is provided, will produce weighted means.

weight_var

if not NULL, a vector that contains weights for each observation. The NULL case is equivalent to all cases being weighted 1.

banner_vars

name of the variables to appear along the top of the table. The number of cross tables produced is equal to the number of banner variables.

table_labels

datamap with variable names and labels. See rsegmenter::extract_datamap

Examples

df <- rsegmenter::test_seg_unlabelled

table_labels <- rsegmenter::extract_datamap(rsegmenter::test_seg_labelled)

profile_table_2(df, category_vars = c("demog1","demog2"), numeric_vars = NULL,
weight_var = "weight", banner_vars = "seg1", table_labels = table_labels)


PrenolanM/rsegmenter documentation built on Aug. 7, 2022, 8:56 p.m.