Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for recoding across multiple variable sets #33

Open
DougManuel opened this issue Oct 26, 2023 · 0 comments
Open

Support for recoding across multiple variable sets #33

DougManuel opened this issue Oct 26, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@DougManuel
Copy link
Contributor

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.

@DougManuel DougManuel added the enhancement New feature or request label Oct 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant