Loading Data into Memory
loading-data-into-memory.Rmd
library(dv.loader)
Note: use_wd = TRUE
can be used to source from local folder. Just set your working directory before using with setwd()
, or use an explicit path in sub_dir
.
Usage: load_data()
test_data_path <- "../tests/testthat/inst/extdata"
data_list <- load_data(
sub_dir = test_data_path,
file_names = "dummyads2",
use_wd = TRUE
)
class(data_list)
#> [1] "list"
class(data_list[["dummyads2"]])
#> [1] "tbl_df" "tbl" "data.frame"
head(data_list[["dummyads2"]])
#> STUDYID USUBJID SUBJID TRTFL PPROTFL TRT01PNDC TRT01PN
#> 1 test-0001 test-0001-101 101 Y Y BI 10mg 50100
#> 2 test-0001 test-0001-101 101 Y Y BI 10mg 50100
#> 3 test-0001 test-0001-101 101 Y Y BI 10mg 50100
#> 4 test-0001 test-0001-101 101 Y Y BI 10mg 50100
#> 5 test-0001 test-0001-102 102 Y Y Placebo 2000
#> 6 test-0001 test-0001-102 102 Y Y Placebo 2000
Get the dataframe’s metadata through its attributes:
attr(data_list[["dummyads2"]], "meta")
#> size isdir mode mtime ctime atime
#> 1 449 FALSE 644 2024-07-08 05:22:03 2024-07-08 05:22:03 2024-07-08 05:22:03
#> path
#> 1 /__w/dv.loader/dv.loader/vignettes/../tests/testthat/inst/extdata/dummyads2.RDS
#> file_name
#> 1 dummyads2