This function takes a path to a source data directory (typically SDTM or ADaM folder), reads in every data file, and returns a named list of the data objects.
read_src_dir(.path, .file_types = "detect", .read_domains = NULL)
Full path to the source data directory.
Type of files being read in (e.g. 'sas7bat'). The default ('detect') will determine file type based on the most occurring file type in .path.
Character vector of domains to read in (e.g. c('dm', 'lb') - default is to load all domains).
path <- system.file("example-sdtm", package = "mrgda")
# Read in all source files
src_list <- read_src_dir(.path = path, .file_types = "detect")
#> ℹ Detected file type = 'xpt'
#> Reading in ae.xpt (6.88 KB)
#> ✔ /opt/rpkgs/4.3/mrgda/example-sdtm/ae.xpt
#> Reading in ae.xpt (6.88 KB)
#> Reading in dm.xpt (3.76 KB)
#> ✔ /opt/rpkgs/4.3/mrgda/example-sdtm/dm.xpt
#> Reading in dm.xpt (3.76 KB)
#> Reading in eg.xpt (14 KB)
#> ✔ /opt/rpkgs/4.3/mrgda/example-sdtm/eg.xpt
#> Reading in eg.xpt (14 KB)
#> Reading in lb.xpt (24.24 KB)
#> ✔ /opt/rpkgs/4.3/mrgda/example-sdtm/lb.xpt
#> Reading in lb.xpt (24.24 KB)
#> Reading in mh.xpt (5.12 KB)
#> ✔ /opt/rpkgs/4.3/mrgda/example-sdtm/mh.xpt
#> Reading in mh.xpt (5.12 KB)
#> Reading in pe.xpt (12.8 KB)
#> ✔ /opt/rpkgs/4.3/mrgda/example-sdtm/pe.xpt
#> Reading in pe.xpt (12.8 KB)
#> Reading in vs.xpt (14.08 KB)
#> ✔ /opt/rpkgs/4.3/mrgda/example-sdtm/vs.xpt
#> Reading in vs.xpt (14.08 KB)
#> ┌ read_src_dir Summary ────────────────────────┐
#> │ │
#> │ Number of domains successfully loaded: 7 │
#> │ Number of domains that failed to load: 0 │
#> │ │
#> └──────────────────────────────────────────────┘
# Read in only "dm" and "lb" domains
src_list <- read_src_dir(.path = path, .file_types = "detect", .read_domains = c("dm", "lb"))
#> ℹ Detected file type = 'xpt'
#> Reading in dm.xpt (3.76 KB)
#> ✔ /opt/rpkgs/4.3/mrgda/example-sdtm/dm.xpt
#> Reading in dm.xpt (3.76 KB)
#> Reading in lb.xpt (24.24 KB)
#> ✔ /opt/rpkgs/4.3/mrgda/example-sdtm/lb.xpt
#> Reading in lb.xpt (24.24 KB)
#> ┌ read_src_dir Summary ────────────────────────┐
#> │ │
#> │ Number of domains successfully loaded: 2 │
#> │ Number of domains that failed to load: 0 │
#> │ │
#> └──────────────────────────────────────────────┘