Skip to contents

Groups several expressions in a single bracketed expression.

Usage

bracket_expr(exprs)

Arguments

exprs

(list of call)
expressions to concatenate into a single bracketed expression.

Examples

library(dplyr)
#> 
#> Attaching package: ‘dplyr’
#> The following objects are masked from ‘package:stats’:
#> 
#>     filter, lag
#> The following objects are masked from ‘package:base’:
#> 
#>     intersect, setdiff, setequal, union
library(scda)
#> 
library(tern)
adsl <- synthetic_cdisc_data("latest")$adsl
adrs <- synthetic_cdisc_data("latest")$adrs

expr1 <- substitute(
  expr = anl <- subset(df, PARAMCD == param),
  env = list(df = as.name("adrs"), param = "INVET")
)
expr2 <- substitute(expr = anl$rsp_lab <- d_onco_rsp_label(anl$AVALC))
expr3 <- substitute(
  expr = {
    anl$is_rsp <- anl$rsp_lab %in%
      c("Complete Response (CR)", "Partial Response (PR)")
  }
)

res <- teal.modules.clinical:::bracket_expr(list(expr1, expr2, expr3))
eval(res)
table(anl$rsp_lab, anl$is_rsp)
#>                           
#>                            FALSE TRUE
#>   Complete Response (CR)       0  164
#>   Not Evaluable (NE)          18    0
#>   Partial Response (PR)        0  101
#>   Progressive Disease (PD)    73    0
#>   Stable Disease (SD)         44    0