Skip to contents

Count then number of columns matching var_pattern that have value var_val.

Usage

count_vars(
  df,
  var_pattern,
  var_val = 1,
  attrib_name,
  attrib_vars = var_pattern
)

Arguments

df

Data frame. Household-level microdata that contains the variables to count.

var_pattern

Character Regular expression used to select variables to be counted.

var_val

Numeric. Value(s) to count in columns identified by var_pattern.

attrib_name

Character. Name of attribute.

attrib_vars

Character. Regular expression that identifies the variable(s) in var_pattern.

Value

Data frame of attributes with the following columns:

  • interview__id

  • interview__key

  • attrib_name

  • attrib_val

  • attrib_vars