Skip to contents

One of slref or anl need to be specified. The conversion from SAS code in filters dataset may not work in all cases. In case of failure a sensible error message should be returned.

Usage

stream_filter(
  slref = NULL,
  anl = NULL,
  filters,
  suffix,
  slref_keep = NULL,
  usubjid = "USUBJID"
)

Arguments

slref

The subject level data frame (typically ASL.sas7bdat on BCE)

anl

The analysis data frame (e.g. ATE.sas7bdat on BCE)

filters

The name of the filters dataset (typically __filters.sas7bdat on BCE)

suffix

The suffix to apply in quotes (e.g. "ITT_PFSINV")

slref_keep

Variables to keep from slref (e.g. c("REGION", "SEX"))

usubjid

The unique subject identifier variable in quotes (e.g. "USUBJID")

Value

dataframe object

Author

Iain Bennett

Examples

library(scda)
ASL <- synthetic_cdisc_data("latest")$adsl
ATE <- synthetic_cdisc_data("latest")$adaette
filters <- as.data.frame(rbind(
  c(ID = "IT", FLTTARGET = "SLREF", FLTWHERE = "where 1 eq 1"),
  c(ID = "BIO", FLTTARGET = "SLREF", FLTWHERE = "where BMRKR1 ge 4.3"),
  c(ID = "M", FLTTARGET = "SLREF", FLTWHERE = "where SEX eq 'M'"),
  c(ID = "PFS", FLTTARGET = "ANL", FLTWHERE = "where PARAMCD eq 'PFS'"),
  c(ID = "OS", FLTTARGET = "ANL", FLTWHERE = "where PARAMCD eq 'OS'")
))

ANL <- stream_filter(
  slref = ASL,
  anl = ATE,
  suffix = "IT_PFS_BIO",
  filters = filters
)
#> Warning: `filter_()` was deprecated in dplyr 0.7.0.
#> Please use `filter()` instead.
#> See vignette('programming') for more help
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
#> 
#> Filter IT applied 
#> SAS code: where 1 eq 1 
#> was converted to
#> R code:   1 == 1  
#> 400 of 400 observations selected from SLREF 
#> 
#> Filter PFS applied 
#> SAS code: where PARAMCD eq 'PFS' 
#> was converted to
#> R code:   PARAMCD == 'PFS'  
#> 0 of 3600 observations selected from ANL 
#> 
#> Filter BIO applied 
#> SAS code: where BMRKR1 ge 4.3 
#> was converted to
#> R code:   BMRKR1 >= 4.3  
#> 231 of 400 observations selected from SLREF 
#> Warning: `transmute_()` was deprecated in dplyr 0.7.0.
#> Please use `transmute()` instead.
#> See vignette('programming') for more help
#> This warning is displayed once every 8 hours.
#> Call `lifecycle::last_lifecycle_warnings()` to see where this warning was generated.
#> 
#> Suffix IT_PFS_BIO was applied
#> 0 of 3600 observations selected from ANL