This function derives the Rave form name and row number from xxSPID. The xxSPID string may yield unexpected results for outsourced studies. Log forms will show the row number as #n. Non-log forms may show #0 after the form name.

roche_derive_rave_row(
  dts,
  domains = c("ae", "ce", "cm", "ds", "lb", "mh", "pr", "rs", "ss", "tr", "tu")
)

Arguments

dts

SDTM dataframe - e.g., AE

domains

domains you wish to identify a xxSPID variable from

Value

dataframe with Rave row number

Author

Stella Banjo (HackR 2021)

Examples


AE <- data.frame(
  STUDY = c(rep("1", 6)),
  DOMAIN = c(rep("AE", 6)),
  USUBJID = c(rep("PT1", 6)),
  AESEQ = c(1, 2, 3, 4, 5, 6),
  AETERM = rep("AE Raw Term",6),
  AEDECOD = rep("AE Preferred Term",6),
  AESPID = c("FORMNAME-R:13/L:13XXXX",
             "FORMNAME-R:16/L:16XXXX",
             "FORMNAME-R:2/L:2XXXX",
             "FORMNAME-R:19/L:19XXXX",
             "FORMNAME-R:5/L:5XXXX",
             "FORMNAME-R:20/L:20XXXX"),
  AESTDTC = c(rep("2020-01-01", 6)),
  stringsAsFactors = FALSE
)

roche_derive_rave_row(AE)
#>   STUDY DOMAIN USUBJID AESEQ      AETERM           AEDECOD
#> 1     1     AE     PT1     1 AE Raw Term AE Preferred Term
#> 2     1     AE     PT1     2 AE Raw Term AE Preferred Term
#> 3     1     AE     PT1     3 AE Raw Term AE Preferred Term
#> 4     1     AE     PT1     4 AE Raw Term AE Preferred Term
#> 5     1     AE     PT1     5 AE Raw Term AE Preferred Term
#> 6     1     AE     PT1     6 AE Raw Term AE Preferred Term
#>                   AESPID    AESTDTC          RAVE
#> 1 FORMNAME-R:13/L:13XXXX 2020-01-01 FORMNAME-R:13
#> 2 FORMNAME-R:16/L:16XXXX 2020-01-01 FORMNAME-R:16
#> 3   FORMNAME-R:2/L:2XXXX 2020-01-01  FORMNAME-R:2
#> 4 FORMNAME-R:19/L:19XXXX 2020-01-01 FORMNAME-R:19
#> 5   FORMNAME-R:5/L:5XXXX 2020-01-01  FORMNAME-R:5
#> 6 FORMNAME-R:20/L:20XXXX 2020-01-01 FORMNAME-R:20