insightsengineering / insightsengineering/teal.transform

allow data_extract_input to work with "interaction" variables

Open
#41 1 comment 0 reactions 0 assignees View on GitHub
core
Dominant language
R
Stars
2
Forks
3
PR merge metrics
No merged PRs in 30d

Description

In `teal.modules.clinical::tm_a_mmrm`, one of the variables needed for the analysis allows for "interaction" terms. These are passed into the template in this form: `variable1:variable2` or `variable1*variable2`.

If we are using a `data_extract_input` and `data_merge_module`, these variables do not exist in the data - but their component variables do (and they must).

What we need from `data_extract_input` is to *optionally* accept some split criteria to separate interaction selections into their component variables. Or maybe this has to be done at the `data_merge_module` level.

The goal is to enable something like this:
```r
data_extract_spec(
dataname = dataname,
select = select_spec(
choices = c("BASE", "AGE", "SEX", "BASE:AVISIT")
)
)
```

Such that the `data_extract_input` shows this in the module:

![image](https://user-images.githubusercontent.com/12943682/128363371-cd6d2f65-1bd6-4892-9f4d-7a27e1341987.png)

But is doing this behind the scenes (Show R Code):

![image](https://user-images.githubusercontent.com/12943682/128363401-b9c00af9-7c12-4e20-b304-73079c5c7487.png)

Note how the "variables" being selected are `BASE`, `AVISIT`, and `SEX` (`BASE:AVISIT` has been split).

You may see the current workaround in `tm_a_mmrm` which currently uses 2 `data_extract_inputs` to accomplish this.

Provenance:
```
Creator: SUNDRELV
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.