Closed chlebowa closed 4 months ago
Oddly, this works just fine:
ADSL <- teal.modules.clinical::tmc_ex_adsl
ADRS <- teal.modules.clinical::tmc_ex_adrs |>
dplyr::mutate(
AVALC = tern::d_onco_rsp_label(AVALC) |>
formatters::with_label("Character Result/Finding")
) |>
dplyr::filter(PARAMCD != "OVRINV" | AVISIT == "FOLLOW UP")
code <- '
ADSL <- teal.modules.clinical::tmc_ex_adsl
ADRS <- teal.modules.clinical::tmc_ex_adrs |>
dplyr::mutate(
AVALC = tern::d_onco_rsp_label(AVALC) |>
formatters::with_label("Character Result/Finding")
) |>
dplyr::filter(PARAMCD != "OVRINV" | AVISIT == "FOLLOW UP")
'
data3 <- teal.data::cdisc_data(
ADRS = ADRS,
ADSL = ADSL,
code = code
)
teal.data::get_code(data3, dataname = "ADRS")
[1] "warning('Code was not verified for reproducibility.')\nADRS <- dplyr::filter(dplyr::mutate(teal.modules.clinical::tmc_ex_adrs, AVALC = formatters::with_label(tern::d_onco_rsp_label(AVALC), \"Character Result/Finding\")), PARAMCD != \"OVRINV\" | AVISIT == \"FOLLOW UP\")"
@chlebowa thanks for pointing that.
It actually works for
code <- '
ADSL <- teal.modules.clinical::tmc_ex_adsl
ADRS <- teal.modules.clinical::tmc_ex_adrs |>
dplyr::mutate(
AVALC = tern::d_onco_rsp_label(AVALC) |>
formatters::with_label("Character Result/Finding")
) |>
dplyr::filter(PARAMCD != "OVRINV" | AVISIT == "FOLLOW UP")
'
teal.data::get_code(teal_data(ADRS = ADRS, ADSL = ADSL, code = code), dataname = "ADRS")
and fails for
code2 <-
'{
ADSL <- teal.modules.clinical::tmc_ex_adsl
ADRS <- teal.modules.clinical::tmc_ex_adrs |>
dplyr::mutate(
AVALC = tern::d_onco_rsp_label(AVALC) |>
formatters::with_label("Character Result/Finding")
) |>
dplyr::filter(PARAMCD != "OVRINV" | AVISIT == "FOLLOW UP")
}'
teal.data::get_code(teal_data(ADRS = ADRS, ADSL = ADSL, code = code2), dataname = "ADRS")
where the only difference is that the second case has {}
at the beginning and at the end. This is also the case with code |> deparse()
that adds those parenthesis around the code. I think we should investigate and improve the parser so that it removes {}
curly brackets before it parses the code
Provided a fix for this in https://github.com/insightsengineering/teal.data/pull/311
What happened?
Code retrieval fails if code passed as character but not if passed as language.
1. Create language obejct and evaluate to create data in global environment.
2. Create
teal_data
by passing code as is.Code retrieved correctly.
3. Create
teal_data
by passing code as character.Code retrieved fails.
This only occurs with
datanames
specified.sessionInfo()
Relevant log output
No response
Code of Conduct
Contribution Guidelines
Security Policy