Skip to content

Support for recoding across multiple variable sets #33

@DougManuel

Description

@DougManuel

Problem Description

Currently, recodeflow does not provide native support for handling multiple variables of the same type. This is limiting for researchers dealing with multifaceted data, especially in health.

Requested feature

Enhance the variableStart argument to accept a vector of variables for derived functions.

Current Status

As of now, variableStart accepts only a single variable for derived functions (I believe).

Minimal example

# Sample data
respondentID = c(1, 2, 3),
med1 = c("DrugA", "DrugC", "DrugB"),
med2 = c("DrugB", "DrugA", "DrugC")

# Hypothetical function call and expected output
# ... Your function call here ...
# Expected Return: c(TRUE, TRUE, FALSE)

Proposed change

New derived variable: is_taking_DrugA

Derived function: is_taking_DrugA_func

variableStart: med

Allowed input for med: variable list of length n, where n > 0.

Importance

This kind of batch recoding is crucial for multiple research scenarios:

People may be on multiple drugs, making it important to identify if any drug is of a specific type or class.
Hospitalization data often contains multiple diagnosis or procedure fields.
Socio-linguistic research may require identifying multiple languages spoken by respondents.

Anticipated questions

Why don't we just have a simple variable list, such as the following:
variableStart: med1, med2

This approach could work but has two limitations:

Verbosity: In large datasets like the Canadian Health Measures Survey that we're currently working with, which has 40 medication variables, specifying each variable individually could become excessively verbose and unwieldy.

Error-Prone: When dealing with multiple sets of similar variables (e.g., med1, med2, ..., med40 and last_taken1, last_taken2, ..., last_taken40), the list-based approach can become both verbose and prone to errors, such as omission or incorrect sequencing.

By contrast, allowing variableStart to accept a vector of variable names would provide a more concise and less error-prone way to manage the recoding across multiple similar variables.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions