Retrieve raw data
get_raw_data.Rd
Usage
get_raw_data(x, dataname = NULL)
# S3 method for TealDataset
get_raw_data(x, dataname = NULL)
# S3 method for TealDatasetConnector
get_raw_data(x, dataname = NULL)
# S3 method for TealDataAbstract
get_raw_data(x, dataname = NULL)
Arguments
- x
(
TealDataset
,TealDatasetConnector
,TealDataAbstract
)
object- dataname
(
character
)
Name of dataset to return raw data for.
Value
data.frame
with the raw data inserted into the R6 objects. In case of
TealDataAbstract
, list
of data.frame
can be returned
if user doesn't specify dataname
- (get_raw_data
from all datasets).
Examples
# TealDataset ---------
library(scda)
ADSL <- synthetic_cdisc_data("latest")$adsl
x <- dataset(dataname = "ADSL", x = ADSL)
get_raw_data(x)
#> # A tibble: 400 × 44
#> STUDYID USUBJID SUBJID SITEID AGE AGEU SEX RACE ETHNIC COUNTRY DTHFL
#> <chr> <chr> <chr> <chr> <int> <fct> <fct> <fct> <fct> <fct> <fct>
#> 1 AB12345 AB12345-C… id-128 CHN-3 32 YEARS M ASIAN NOT H… CHN N
#> 2 AB12345 AB12345-C… id-262 CHN-15 35 YEARS M BLAC… NOT H… CHN N
#> 3 AB12345 AB12345-R… id-378 RUS-3 30 YEARS F ASIAN NOT H… RUS N
#> 4 AB12345 AB12345-C… id-220 CHN-11 26 YEARS F ASIAN NOT H… CHN N
#> 5 AB12345 AB12345-C… id-267 CHN-7 40 YEARS M ASIAN UNKNO… CHN N
#> 6 AB12345 AB12345-C… id-201 CHN-15 49 YEARS M ASIAN NOT H… CHN N
#> 7 AB12345 AB12345-U… id-45 USA-1 34 YEARS F ASIAN NOT H… USA N
#> 8 AB12345 AB12345-U… id-261 USA-1 32 YEARS F ASIAN NOT H… USA N
#> 9 AB12345 AB12345-N… id-173 NGA-11 24 YEARS F BLAC… NOT H… NGA N
#> 10 AB12345 AB12345-C… id-307 CHN-1 24 YEARS M ASIAN NOT H… CHN N
#> # … with 390 more rows, and 33 more variables: INVID <chr>, INVNAM <chr>,
#> # ARM <fct>, ARMCD <fct>, ACTARM <fct>, ACTARMCD <fct>, TRT01P <fct>,
#> # TRT01A <fct>, REGION1 <fct>, STRATA1 <fct>, STRATA2 <fct>, BMRKR1 <dbl>,
#> # BMRKR2 <fct>, ITTFL <fct>, SAFFL <fct>, BMEASIFL <fct>, BEP01FL <fct>,
#> # RANDDT <date>, TRTSDTM <dttm>, TRTEDTM <dttm>, EOSSTT <fct>, EOTSTT <fct>,
#> # EOSDT <date>, EOSDY <int>, DCSREAS <fct>, DTHDT <date>, DTHCAUS <fct>,
#> # DTHCAT <fct>, LDDTHELD <int>, LDDTHGR1 <fct>, LSTALVDT <date>, …
# TealDatasetConnector ---------
library(scda)
pull_fun_adsl <- callable_function(
function() {
synthetic_cdisc_data("latest")$adsl
}
)
dc <- dataset_connector("ADSL", pull_fun_adsl)
load_dataset(dc)
get_raw_data(dc)
#> # A tibble: 400 × 44
#> STUDYID USUBJID SUBJID SITEID AGE AGEU SEX RACE ETHNIC COUNTRY DTHFL
#> <chr> <chr> <chr> <chr> <int> <fct> <fct> <fct> <fct> <fct> <fct>
#> 1 AB12345 AB12345-C… id-128 CHN-3 32 YEARS M ASIAN NOT H… CHN N
#> 2 AB12345 AB12345-C… id-262 CHN-15 35 YEARS M BLAC… NOT H… CHN N
#> 3 AB12345 AB12345-R… id-378 RUS-3 30 YEARS F ASIAN NOT H… RUS N
#> 4 AB12345 AB12345-C… id-220 CHN-11 26 YEARS F ASIAN NOT H… CHN N
#> 5 AB12345 AB12345-C… id-267 CHN-7 40 YEARS M ASIAN UNKNO… CHN N
#> 6 AB12345 AB12345-C… id-201 CHN-15 49 YEARS M ASIAN NOT H… CHN N
#> 7 AB12345 AB12345-U… id-45 USA-1 34 YEARS F ASIAN NOT H… USA N
#> 8 AB12345 AB12345-U… id-261 USA-1 32 YEARS F ASIAN NOT H… USA N
#> 9 AB12345 AB12345-N… id-173 NGA-11 24 YEARS F BLAC… NOT H… NGA N
#> 10 AB12345 AB12345-C… id-307 CHN-1 24 YEARS M ASIAN NOT H… CHN N
#> # … with 390 more rows, and 33 more variables: INVID <chr>, INVNAM <chr>,
#> # ARM <fct>, ARMCD <fct>, ACTARM <fct>, ACTARMCD <fct>, TRT01P <fct>,
#> # TRT01A <fct>, REGION1 <fct>, STRATA1 <fct>, STRATA2 <fct>, BMRKR1 <dbl>,
#> # BMRKR2 <fct>, ITTFL <fct>, SAFFL <fct>, BMEASIFL <fct>, BEP01FL <fct>,
#> # RANDDT <date>, TRTSDTM <dttm>, TRTEDTM <dttm>, EOSSTT <fct>, EOTSTT <fct>,
#> # EOSDT <date>, EOSDY <int>, DCSREAS <fct>, DTHDT <date>, DTHCAUS <fct>,
#> # DTHCAT <fct>, LDDTHELD <int>, LDDTHGR1 <fct>, LSTALVDT <date>, …
# TealData ----------------
library(scda)
adsl <- cdisc_dataset(
dataname = "ADSL",
x = synthetic_cdisc_data("latest")$adsl,
code = "library(scda)\nADSL <- synthetic_cdisc_data(\"latest\")$adsl"
)
adtte <- cdisc_dataset(
dataname = "ADTTE",
x = synthetic_cdisc_data("latest")$adtte,
code = "library(scda)\nADTTE <- synthetic_cdisc_data(\"latest\")$adtte"
)
rd <- teal.data:::TealData$new(adsl, adtte)
get_raw_data(rd)
#> $ADSL
#> # A tibble: 400 × 44
#> STUDYID USUBJID SUBJID SITEID AGE AGEU SEX RACE ETHNIC COUNTRY DTHFL
#> <chr> <chr> <chr> <chr> <int> <fct> <fct> <fct> <fct> <fct> <fct>
#> 1 AB12345 AB12345-C… id-128 CHN-3 32 YEARS M ASIAN NOT H… CHN N
#> 2 AB12345 AB12345-C… id-262 CHN-15 35 YEARS M BLAC… NOT H… CHN N
#> 3 AB12345 AB12345-R… id-378 RUS-3 30 YEARS F ASIAN NOT H… RUS N
#> 4 AB12345 AB12345-C… id-220 CHN-11 26 YEARS F ASIAN NOT H… CHN N
#> 5 AB12345 AB12345-C… id-267 CHN-7 40 YEARS M ASIAN UNKNO… CHN N
#> 6 AB12345 AB12345-C… id-201 CHN-15 49 YEARS M ASIAN NOT H… CHN N
#> 7 AB12345 AB12345-U… id-45 USA-1 34 YEARS F ASIAN NOT H… USA N
#> 8 AB12345 AB12345-U… id-261 USA-1 32 YEARS F ASIAN NOT H… USA N
#> 9 AB12345 AB12345-N… id-173 NGA-11 24 YEARS F BLAC… NOT H… NGA N
#> 10 AB12345 AB12345-C… id-307 CHN-1 24 YEARS M ASIAN NOT H… CHN N
#> # … with 390 more rows, and 33 more variables: INVID <chr>, INVNAM <chr>,
#> # ARM <fct>, ARMCD <fct>, ACTARM <fct>, ACTARMCD <fct>, TRT01P <fct>,
#> # TRT01A <fct>, REGION1 <fct>, STRATA1 <fct>, STRATA2 <fct>, BMRKR1 <dbl>,
#> # BMRKR2 <fct>, ITTFL <fct>, SAFFL <fct>, BMEASIFL <fct>, BEP01FL <fct>,
#> # RANDDT <date>, TRTSDTM <dttm>, TRTEDTM <dttm>, EOSSTT <fct>, EOTSTT <fct>,
#> # EOSDT <date>, EOSDY <int>, DCSREAS <fct>, DTHDT <date>, DTHCAUS <fct>,
#> # DTHCAT <fct>, LDDTHELD <int>, LDDTHGR1 <fct>, LSTALVDT <date>, …
#>
#> $ADTTE
#> # A tibble: 1,600 × 55
#> STUDYID USUBJID SUBJID SITEID AGE AGEU SEX RACE ETHNIC COUNTRY DTHFL
#> <chr> <chr> <chr> <chr> <int> <fct> <fct> <fct> <fct> <fct> <fct>
#> 1 AB12345 AB12345-B… id-105 BRA-1 38 YEARS M BLAC… NOT H… BRA N
#> 2 AB12345 AB12345-B… id-105 BRA-1 38 YEARS M BLAC… NOT H… BRA N
#> 3 AB12345 AB12345-B… id-105 BRA-1 38 YEARS M BLAC… NOT H… BRA N
#> 4 AB12345 AB12345-B… id-105 BRA-1 38 YEARS M BLAC… NOT H… BRA N
#> 5 AB12345 AB12345-B… id-134 BRA-1 47 YEARS M WHITE NOT H… BRA N
#> 6 AB12345 AB12345-B… id-134 BRA-1 47 YEARS M WHITE NOT H… BRA N
#> 7 AB12345 AB12345-B… id-134 BRA-1 47 YEARS M WHITE NOT H… BRA N
#> 8 AB12345 AB12345-B… id-134 BRA-1 47 YEARS M WHITE NOT H… BRA N
#> 9 AB12345 AB12345-B… id-141 BRA-1 35 YEARS F WHITE NOT H… BRA N
#> 10 AB12345 AB12345-B… id-141 BRA-1 35 YEARS F WHITE NOT H… BRA N
#> # … with 1,590 more rows, and 44 more variables: INVID <chr>, INVNAM <chr>,
#> # ARM <fct>, ARMCD <fct>, ACTARM <fct>, ACTARMCD <fct>, TRT01P <fct>,
#> # TRT01A <fct>, REGION1 <fct>, STRATA1 <fct>, STRATA2 <fct>, BMRKR1 <dbl>,
#> # BMRKR2 <fct>, ITTFL <fct>, SAFFL <fct>, BMEASIFL <fct>, BEP01FL <fct>,
#> # RANDDT <date>, TRTSDTM <dttm>, TRTEDTM <dttm>, EOSSTT <fct>, EOTSTT <fct>,
#> # EOSDT <date>, EOSDY <int>, DCSREAS <fct>, DTHDT <date>, DTHCAUS <fct>,
#> # DTHCAT <fct>, LDDTHELD <int>, LDDTHGR1 <fct>, LSTALVDT <date>, …
#>
# TealDataConnector --------
adsl_cf <- callable_function(function() synthetic_cdisc_data("latest")$adsl)
adsl <- cdisc_dataset_connector(
dataname = "ADSL",
pull_callable = adsl_cf,
keys = get_cdisc_keys("ADSL")
)
adlb_cf <- callable_function(function() synthetic_cdisc_data("latest")$adlb)
adlb <- cdisc_dataset_connector(
dataname = "ADLB",
pull_callable = adlb_cf,
keys = get_cdisc_keys("ADLB")
)
rdc <- relational_data_connector(
connection = data_connection(),
connectors = list(adsl, adlb)
)
if (FALSE) {
load_datasets(rdc)
get_raw_data(rdc)
}
# TealData (with connectors) --------
drc <- cdisc_data(rdc)
if (FALSE) {
get_raw_data(drc)
}