Skip to contents

[Stable]

Get dataset from TealDatasetConnector

Usage

get_dataset(x, dataname)

# S3 method for TealDatasetConnector
get_dataset(x, dataname = NULL)

# S3 method for TealDataset
get_dataset(x, dataname = NULL)

# S3 method for TealDataAbstract
get_dataset(x, dataname = NULL)

Arguments

x

(TealDatasetConnector or TealDatasetConnector or TealDataAbstract)

dataname

(character) a name of dataset to be retrieved

Value

(TealDataset)

Details

See help(TealDataConnector) and help(TealData) for more complex examples.

Examples


# TealDatasetConnector --------
library(magrittr)

pull_fun_adae <- callable_function(teal.data::example_cdisc_data) %>%
  set_args(list(dataname = "ADAE"))

ADSL <- teal.data::example_cdisc_data("ADSL")

dc <- dataset_connector(
  dataname = "ADAE", pull_callable = pull_fun_adae,
  keys = get_cdisc_keys("ADSL")
)

if (FALSE) {
load_dataset(dc)
get_dataset(dc)
}


# TealDataset --------
ADSL <- example_cdisc_data("ADSL")
x <- dataset("ADSL", ADSL)

get_dataset(x)
#> 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
#> ...

# TealData  (not containing connectors) --------
adsl <- cdisc_dataset(
  dataname = "ADSL",
  x = example_cdisc_data("ADSL"),
  code = "library(teal.data)\nADSL <- example_cdisc_data(\"ADSL\")"
)

adae <- cdisc_dataset(
  dataname = "ADAE",
  x = example_cdisc_data("ADAE"),
  code = "library(teal.data)\nADAE <- example_cdisc_data(\"ADAE\")"
)

rd <- teal.data:::TealData$new(adsl, adae)
get_dataset(rd, "ADSL")
#> A CDISCTealDataset 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
#> ...