convert_checkbox_vals function

Convert a new checkbox column's values

Convert a new checkbox column's values

This function takes a single column of data and converts the values based on the overall data tibble cross referenced with a nested section of the metadata tibble.

case_when logic helps determine whether the value is a coalesced singular value or a user-specified one via multi_value_label or values_fill.

convert_checkbox_vals( metadata, .new_value, data_tbl, raw_or_label, multi_value_label, values_fill )

Arguments

  • metadata: A nested portion of the overall metadata tibble
  • .new_value: The new column values made by combine_checkboxes()
  • data_tbl: The data tibble from the original supertibble
  • raw_or_label: Either 'raw' or 'label' to specify whether to use raw coded values or labels for the options. Default 'label'.
  • multi_value_label: A string specifying the value to be used when multiple checkbox fields are selected. Default "Multiple".
  • values_fill: Value to use when no checkboxes are selected. Default NA.

Details

This function is used in conjunction with pmap().