prepare_extended_col: Manipulate Data with Multiple Choice Questions

View source: R/transform.R

prepare_extended_colR Documentation

Manipulate Data with Multiple Choice Questions

Description

There were multiple-choice questions wherein more than one option was permissible i.e. check-list kind of questions. These questions needed to be brought together into a single variable at some point in the analysis. After this was done, these options were brought together into a list column. This function will expand that list column, creating new columns - one for each response.

Usage

prepare_extended_col(
  data,
  variable,
  options,
  multisectoral = TRUE,
  notReferral = multisectoral
)

Arguments

data

A data frame that contains the column to be collapsed

variable

A character vector of length 1 representing the name of the column to be extended

options

The would-be levels of the resulting factor column i.e. the question's values as they are to appear in a new factor.

multisectoral

Logical. Whether work is on a combined data frame i.e. the question cuts across various sectors of the analysis e.g. health, legal aid, etc.

notReferral

Logical. Whether not Referral Directory data

Value

A modified data frame with the choices now appearing as levels of a factor.


BroVic/raampGBV documentation built on Oct. 7, 2022, 11:06 p.m.