Skip to contents

[Stable] Load data from connection. Function used on TealDatasetConnector and TealDataset to obtain data from connection.

Usage

load_dataset(x, ...)

# S3 method for TealDataset
load_dataset(x, ...)

# S3 method for TealDatasetConnector
load_dataset(x, args = NULL, try = FALSE, conn = NULL, ...)

Arguments

x

(TealDatasetConnector or TealDataset)

...

not used, only for support of S3

args

(NULL or named list)
additional dynamic arguments passed to function which loads the data.

try

(logical) whether perform function evaluation inside try clause

conn

Optional (TealDataConnection) object required to pull the data.

Value

x with loaded dataset object

Examples


# TealDataset --------
ADSL <- teal.data::example_cdisc_data("ADSL")
ADSL_dataset <- dataset("ADSL", x = ADSL)

load_dataset(ADSL_dataset)

# TealDatasetConnector --------

random_data_connector <- function(dataname) {
  fun_dataset_connector(
    dataname = dataname,
    fun = teal.data::example_cdisc_data,
    fun_args = list(dataname = dataname),
  )
}

adsl <- random_data_connector(dataname = "ADSL")
load_dataset(adsl)
get_dataset(adsl)
#> A TealDataset object containing the following data.frame (400 rows and 55 columns):
#>   STUDYID               USUBJID SUBJID SITEID AGE  AGEU SEX
#> 1 AB12345  AB12345-CHN-3-id-128 id-128  CHN-3  32 YEARS   M
#> 2 AB12345 AB12345-CHN-15-id-262 id-262 CHN-15  35 YEARS   M
#> 3 AB12345  AB12345-RUS-3-id-378 id-378  RUS-3  30 YEARS   F
#> 4 AB12345 AB12345-CHN-11-id-220 id-220 CHN-11  26 YEARS   F
#> 5 AB12345  AB12345-CHN-7-id-267 id-267  CHN-7  40 YEARS   M
#> 6 AB12345 AB12345-CHN-15-id-201 id-201 CHN-15  49 YEARS   M
#>                        RACE                 ETHNIC COUNTRY DTHFL         INVID
#> 1                     ASIAN     HISPANIC OR LATINO     CHN     Y  INV ID CHN-3
#> 2 BLACK OR AFRICAN AMERICAN NOT HISPANIC OR LATINO     CHN     N INV ID CHN-15
#> 3                     ASIAN NOT HISPANIC OR LATINO     RUS     N  INV ID RUS-3
#> 4                     ASIAN NOT HISPANIC OR LATINO     CHN     N INV ID CHN-11
#> 5                     ASIAN NOT HISPANIC OR LATINO     CHN     N  INV ID CHN-7
#> 6                     ASIAN NOT HISPANIC OR LATINO     CHN     Y INV ID CHN-15
#>           INVNAM            ARM ARMCD         ACTARM ACTARMCD         TRT01P
#> 1  Dr. CHN-3 Doe      A: Drug X ARM A      A: Drug X    ARM A      A: Drug X
#> 2 Dr. CHN-15 Doe C: Combination ARM C C: Combination    ARM C C: Combination
#> 3  Dr. RUS-3 Doe C: Combination ARM C C: Combination    ARM C C: Combination
#> 4 Dr. CHN-11 Doe     B: Placebo ARM B     B: Placebo    ARM B     B: Placebo
#> 5  Dr. CHN-7 Doe     B: Placebo ARM B     B: Placebo    ARM B     B: Placebo
#> 6 Dr. CHN-15 Doe C: Combination ARM C C: Combination    ARM C C: Combination
#>           TRT01A         TRT02P         TRT02A REGION1 STRATA1 STRATA2
#> 1      A: Drug X     B: Placebo      A: Drug X    Asia       C      S2
#> 2 C: Combination     B: Placebo C: Combination    Asia       C      S1
#> 3 C: Combination      A: Drug X     B: Placebo Eurasia       A      S1
#> 4     B: Placebo     B: Placebo     B: Placebo    Asia       B      S2
#> 5     B: Placebo C: Combination      A: Drug X    Asia       C      S1
#> 6 C: Combination     B: Placebo C: Combination    Asia       C      S2
#>      BMRKR1 BMRKR2 ITTFL SAFFL BMEASIFL BEP01FL AEWITHFL     RANDDT
#> 1 14.424934 MEDIUM     Y     Y        Y       Y        N 2019-02-22
#> 2  4.055463    LOW     Y     Y        N       N        Y 2019-02-26
#> 3  2.803240   HIGH     Y     Y        Y       N        N 2019-02-24
#> 4 10.262734 MEDIUM     Y     Y        Y       Y        N 2019-02-27
#> 5  6.206763    LOW     Y     Y        N       N        N 2019-03-01
#> 6  6.906799 MEDIUM     Y     Y        Y       N        N 2019-03-05
#>               TRTSDTM             TRTEDTM           TRT01SDTM
#> 1 2019-02-24 11:09:25 2022-02-12 04:28:08 2019-02-24 11:09:25
#> 2 2019-02-26 09:05:10 2022-02-26 03:05:10 2019-02-26 09:05:10
#> 3 2019-02-28 03:19:22 2022-02-27 21:19:22 2019-02-28 03:19:22
#> 4 2019-03-01 13:33:19 2022-03-01 07:33:19 2019-03-01 13:33:19
#> 5 2019-03-02 00:09:33 2022-03-01 18:09:33 2019-03-02 00:09:33
#> 6 2019-03-05 15:24:07 2022-02-19 04:06:48 2019-03-05 15:24:07
#>             TRT01EDTM           TRT02SDTM           TRT02EDTM
#> 1 2021-02-11 22:28:08 2021-02-11 22:28:08 2022-02-12 04:28:08
#> 2 2021-02-25 21:05:10 2021-02-25 21:05:10 2022-02-26 03:05:10
#> 3 2021-02-27 15:19:22 2021-02-27 15:19:22 2022-02-27 21:19:22
#> 4 2021-03-01 01:33:19 2021-03-01 01:33:19 2022-03-01 07:33:19
#> 5 2021-03-01 12:09:33 2021-03-01 12:09:33 2022-03-01 18:09:33
#> 6 2021-02-18 22:06:48 2021-02-18 22:06:48 2022-02-19 04:06:48
#>              AP01SDTM            AP01EDTM            AP02SDTM
#> 1 2019-02-24 11:09:25 2021-02-11 22:28:08 2021-02-11 22:28:08
#> 2 2019-02-26 09:05:10 2021-02-25 21:05:10 2021-02-25 21:05:10
#> 3 2019-02-28 03:19:22 2021-02-27 15:19:22 2021-02-27 15:19:22
#> 4 2019-03-01 13:33:19 2021-03-01 01:33:19 2021-03-01 01:33:19
#> 5 2019-03-02 00:09:33 2021-03-01 12:09:33 2021-03-01 12:09:33
#> 6 2019-03-05 15:24:07 2021-02-18 22:06:48 2021-02-18 22:06:48
#>              AP02EDTM       EOSSTT       EOTSTT      EOSDT EOSDY DCSREAS
#> 1 2022-02-12 04:28:08 DISCONTINUED DISCONTINUED 2022-02-12  1084   DEATH
#> 2 2022-02-26 03:05:10    COMPLETED    COMPLETED 2022-02-26  1096    <NA>
#> 3 2022-02-27 21:19:22    COMPLETED    COMPLETED 2022-02-27  1096    <NA>
#> 4 2022-03-01 07:33:19    COMPLETED    COMPLETED 2022-03-01  1096    <NA>
#> 5 2022-03-01 18:09:33    COMPLETED    COMPLETED 2022-03-01  1096    <NA>
#> 6 2022-02-19 04:06:48 DISCONTINUED DISCONTINUED 2022-02-19  1082   DEATH
#>        DTHDT       DTHCAUS        DTHCAT LDDTHELD LDDTHGR1   LSTALVDT DTHADY
#> 1 2022-03-06 ADVERSE EVENT ADVERSE EVENT       22     <=30 2022-03-06   1105
#> 2       <NA>          <NA>          <NA>       NA     <NA> 2022-03-17     NA
#> 3       <NA>          <NA>          <NA>       NA     <NA> 2022-03-11     NA
#> 4       <NA>          <NA>          <NA>       NA     <NA> 2022-03-26     NA
#> 5       <NA>          <NA>          <NA>       NA     <NA> 2022-03-15     NA
#> 6 2022-02-22 ADVERSE EVENT ADVERSE EVENT        3     <=30 2022-02-22   1084
#>   ADTHAUT
#> 1     Yes
#> 2    <NA>
#> 3    <NA>
#> 4    <NA>
#> 5    <NA>
#> 6     Yes
#> ...

adae <- random_data_connector(dataname = "ADAE")
load_dataset(adae)
get_dataset(adae)
#> A TealDataset object containing the following data.frame (1934 rows and 92 columns):
#>   STUDYID              USUBJID SUBJID SITEID AGE  AGEU SEX  RACE
#> 1 AB12345 AB12345-BRA-1-id-134 id-134  BRA-1  47 YEARS   M WHITE
#> 2 AB12345 AB12345-BRA-1-id-134 id-134  BRA-1  47 YEARS   M WHITE
#> 3 AB12345 AB12345-BRA-1-id-134 id-134  BRA-1  47 YEARS   M WHITE
#> 4 AB12345 AB12345-BRA-1-id-134 id-134  BRA-1  47 YEARS   M WHITE
#> 5 AB12345 AB12345-BRA-1-id-141 id-141  BRA-1  35 YEARS   F WHITE
#> 6 AB12345 AB12345-BRA-1-id-141 id-141  BRA-1  35 YEARS   F WHITE
#>                   ETHNIC COUNTRY DTHFL        INVID        INVNAM
#> 1 NOT HISPANIC OR LATINO     BRA     Y INV ID BRA-1 Dr. BRA-1 Doe
#> 2 NOT HISPANIC OR LATINO     BRA     Y INV ID BRA-1 Dr. BRA-1 Doe
#> 3 NOT HISPANIC OR LATINO     BRA     Y INV ID BRA-1 Dr. BRA-1 Doe
#> 4 NOT HISPANIC OR LATINO     BRA     Y INV ID BRA-1 Dr. BRA-1 Doe
#> 5 NOT HISPANIC OR LATINO     BRA     N INV ID BRA-1 Dr. BRA-1 Doe
#> 6 NOT HISPANIC OR LATINO     BRA     N INV ID BRA-1 Dr. BRA-1 Doe
#>              ARM ARMCD         ACTARM ACTARMCD         TRT01P         TRT01A
#> 1      A: Drug X ARM A      A: Drug X    ARM A      A: Drug X      A: Drug X
#> 2      A: Drug X ARM A      A: Drug X    ARM A      A: Drug X      A: Drug X
#> 3      A: Drug X ARM A      A: Drug X    ARM A      A: Drug X      A: Drug X
#> 4      A: Drug X ARM A      A: Drug X    ARM A      A: Drug X      A: Drug X
#> 5 C: Combination ARM C C: Combination    ARM C C: Combination C: Combination
#> 6 C: Combination ARM C C: Combination    ARM C C: Combination C: Combination
#>           TRT02P         TRT02A       REGION1 STRATA1 STRATA2   BMRKR1 BMRKR2
#> 1     B: Placebo      A: Drug X South America       B      S2 6.462991    LOW
#> 2     B: Placebo      A: Drug X South America       B      S2 6.462991    LOW
#> 3     B: Placebo      A: Drug X South America       B      S2 6.462991    LOW
#> 4     B: Placebo      A: Drug X South America       B      S2 6.462991    LOW
#> 5 C: Combination C: Combination South America       B      S1 7.516076   HIGH
#> 6 C: Combination C: Combination South America       B      S1 7.516076   HIGH
#>   ITTFL SAFFL BMEASIFL BEP01FL AEWITHFL     RANDDT             TRTSDTM
#> 1     Y     Y        Y       N        N 2020-11-03 2020-11-04 04:08:58
#> 2     Y     Y        Y       N        N 2020-11-03 2020-11-04 04:08:58
#> 3     Y     Y        Y       N        N 2020-11-03 2020-11-04 04:08:58
#> 4     Y     Y        Y       N        N 2020-11-03 2020-11-04 04:08:58
#> 5     Y     Y        Y       Y        N 2020-07-22 2020-07-25 14:26:21
#> 6     Y     Y        Y       Y        N 2020-07-22 2020-07-25 14:26:21
#>               TRTEDTM           TRT01SDTM           TRT01EDTM
#> 1 2022-02-20 03:33:55 2020-11-04 04:08:58 2021-02-19 21:33:55
#> 2 2022-02-20 03:33:55 2020-11-04 04:08:58 2021-02-19 21:33:55
#> 3 2022-02-20 03:33:55 2020-11-04 04:08:58 2021-02-19 21:33:55
#> 4 2022-02-20 03:33:55 2020-11-04 04:08:58 2021-02-19 21:33:55
#> 5 2023-07-26 08:26:21 2020-07-25 14:26:21 2022-07-26 02:26:21
#> 6 2023-07-26 08:26:21 2020-07-25 14:26:21 2022-07-26 02:26:21
#>             TRT02SDTM           TRT02EDTM            AP01SDTM
#> 1 2021-02-19 21:33:55 2022-02-20 03:33:55 2020-11-04 04:08:58
#> 2 2021-02-19 21:33:55 2022-02-20 03:33:55 2020-11-04 04:08:58
#> 3 2021-02-19 21:33:55 2022-02-20 03:33:55 2020-11-04 04:08:58
#> 4 2021-02-19 21:33:55 2022-02-20 03:33:55 2020-11-04 04:08:58
#> 5 2022-07-26 02:26:21 2023-07-26 08:26:21 2020-07-25 14:26:21
#> 6 2022-07-26 02:26:21 2023-07-26 08:26:21 2020-07-25 14:26:21
#>              AP01EDTM            AP02SDTM            AP02EDTM       EOSSTT
#> 1 2021-02-19 21:33:55 2021-02-19 21:33:55 2022-02-20 03:33:55 DISCONTINUED
#> 2 2021-02-19 21:33:55 2021-02-19 21:33:55 2022-02-20 03:33:55 DISCONTINUED
#> 3 2021-02-19 21:33:55 2021-02-19 21:33:55 2022-02-20 03:33:55 DISCONTINUED
#> 4 2021-02-19 21:33:55 2021-02-19 21:33:55 2022-02-20 03:33:55 DISCONTINUED
#> 5 2022-07-26 02:26:21 2022-07-26 02:26:21 2023-07-26 08:26:21    COMPLETED
#> 6 2022-07-26 02:26:21 2022-07-26 02:26:21 2023-07-26 08:26:21    COMPLETED
#>         EOTSTT      EOSDT EOSDY DCSREAS      DTHDT       DTHCAUS        DTHCAT
#> 1 DISCONTINUED 2022-02-20   473   DEATH 2022-03-16 ADVERSE EVENT ADVERSE EVENT
#> 2 DISCONTINUED 2022-02-20   473   DEATH 2022-03-16 ADVERSE EVENT ADVERSE EVENT
#> 3 DISCONTINUED 2022-02-20   473   DEATH 2022-03-16 ADVERSE EVENT ADVERSE EVENT
#> 4 DISCONTINUED 2022-02-20   473   DEATH 2022-03-16 ADVERSE EVENT ADVERSE EVENT
#> 5    COMPLETED 2023-07-26  1096    <NA>       <NA>          <NA>          <NA>
#> 6    COMPLETED 2023-07-26  1096    <NA>       <NA>          <NA>          <NA>
#>   LDDTHELD LDDTHGR1   LSTALVDT DTHADY ADTHAUT ASEQ AESEQ        AETERM
#> 1       24     <=30 2022-03-16    496     Yes    1     1 trm B.2.1.2.1
#> 2       24     <=30 2022-03-16    496     Yes    2     2 trm D.1.1.4.2
#> 3       24     <=30 2022-03-16    496     Yes    3     3 trm A.1.1.1.2
#> 4       24     <=30 2022-03-16    496     Yes    4     4 trm A.1.1.1.2
#> 5       NA     <NA> 2023-08-08     NA    <NA>    1     1 trm B.2.1.2.1
#> 6       NA     <NA> 2023-08-08     NA    <NA>    2     2 trm D.2.1.5.3
#>           AELLT       AEDECOD       AEHLT     AEHLGT AEBODSYS AESOC    AESEV
#> 1 llt B.2.1.2.1 dcd B.2.1.2.1 hlt B.2.1.2 hlgt B.2.1   cl B.2  cl B MODERATE
#> 2 llt D.1.1.4.2 dcd D.1.1.4.2 hlt D.1.1.4 hlgt D.1.1   cl D.1  cl D MODERATE
#> 3 llt A.1.1.1.2 dcd A.1.1.1.2 hlt A.1.1.1 hlgt A.1.1   cl A.1  cl A MODERATE
#> 4 llt A.1.1.1.2 dcd A.1.1.1.2 hlt A.1.1.1 hlgt A.1.1   cl A.1  cl A MODERATE
#> 5 llt B.2.1.2.1 dcd B.2.1.2.1 hlt B.2.1.2 hlgt B.2.1   cl B.2  cl B MODERATE
#> 6 llt D.2.1.5.3 dcd D.2.1.5.3 hlt D.2.1.5 hlgt D.2.1   cl D.2  cl D     MILD
#>   AESER            AEACN AEREL                AEOUT AESDTH AESCONG AESDISAB
#> 1     N DOSE NOT CHANGED     N RECOVERING/RESOLVING      N       N        Y
#> 2     N DOSE NOT CHANGED     N RECOVERING/RESOLVING      N       N        Y
#> 3     Y DOSE NOT CHANGED     N RECOVERING/RESOLVING      N       N        Y
#> 4     Y   DRUG WITHDRAWN     N RECOVERING/RESOLVING      N       Y        N
#> 5     N   DOSE INCREASED     N   RECOVERED/RESOLVED      N       N        N
#> 6     N   DOSE INCREASED     Y   RECOVERED/RESOLVED      N       N        Y
#>   AESHOSP AESLIFE AESMIE TRTEMFL AECONTRT              ASTDTM
#> 1       N       N      N       Y        Y 2021-04-15 04:08:58
#> 2       N       N      N       Y        N 2021-05-19 04:08:58
#> 3       N       N      N       Y        Y 2021-09-21 04:08:58
#> 4       N       N      N       Y        N 2021-12-02 04:08:58
#> 5       Y       N      N       Y        Y 2021-08-16 14:26:21
#> 6       N       N      N       Y        N 2021-10-23 14:26:21
#>                AENDTM ASTDY AENDY            LDOSEDTM    LDRELTM AETOXGR
#> 1 2021-10-04 04:08:58   162   334 2020-11-07 09:05:04 228663.896       3
#> 2 2021-10-31 04:08:58   196   361 2021-05-17 07:21:09   2687.814       3
#> 3 2022-02-16 04:08:58   321   469 2021-05-23 15:14:37 173574.345       2
#> 4 2022-01-13 04:08:58   393   435 2021-03-19 08:52:05 371236.878       2
#> 5 2021-08-26 14:26:21   387   397 2021-07-22 06:04:04  36502.291       3
#> 6 2023-07-12 14:26:21   455  1082 2021-07-16 21:30:39 142135.710       1
#>   SMQ01NAM SMQ02NAM SMQ01SC SMQ02SC                  CQ01NAM ANL01FL
#> 1     <NA>     <NA>    <NA>    <NA>                     <NA>       Y
#> 2     <NA>     <NA>    <NA>    <NA>                     <NA>       Y
#> 3     <NA>     <NA>    <NA>    <NA>                     <NA>       Y
#> 4     <NA>     <NA>    <NA>    <NA>                     <NA>       Y
#> 5     <NA>     <NA>    <NA>    <NA>                     <NA>       Y
#> 6     <NA>     <NA>    <NA>    <NA> D.2.1.5.3/A.1.1.1.1 AESI       Y
#>             AERELNST                        AEACNOTH
#> 1               NONE               PROCEDURE/SURGERY
#> 2 CONCURRENT ILLNESS                      MEDICATION
#> 3 CONCURRENT ILLNESS SUBJECT DISCONTINUED FROM STUDY
#> 4 CONCURRENT ILLNESS SUBJECT DISCONTINUED FROM STUDY
#> 5 CONCURRENT ILLNESS               PROCEDURE/SURGERY
#> 6 CONCURRENT ILLNESS                      MEDICATION
#> ...