Create specification object for ADaM data sets of type 'bds'
Source:R/adam_spec_bds.R
adam_spec_bds.RdGiven a file containing a bds data set (e.g. adlb or advs),
adam_spec_bds() will create a specification
object for use in build_bds() to prepare the data to
be used in machine learning.
The main task is to collect the key columns
for reshaping the data into wide format and prepare the data filter.
Usage
adam_spec_bds(
file = NULL,
data = NULL,
id = "USUBJID",
param = NULL,
label = NULL,
unit = NULL,
time = NULL,
value = NULL,
filter = NULL,
attach_data = FALSE,
domain = NULL
)Arguments
- file
the path of the sas(7bdat) or rds file to process, ignored if
datais provided- data
tibble with the data in bds format for which the specification is created
- id
name of id column to be kept and used for merge of data sets
- param
name of the column that identifies the parameter. Defaults to
NULL, will be guessed if not set (see Details).- label
name of the column that gives column labels. Defaults to
NULL.- unit
Defaults to
NULL, will be guessed if not set (see Details).- time
Defaults to
NULL, will be guessed if not set (see Details).- value
Defaults to
NULL, will be guessed if not set (see Details).- filter
character vector of filters to be applied to the bds data set. Individual filters will only be considered if the resulting data set has positive number of rows. Defaults to
NULL.- attach_data
boolean. Attach the imported raw data.
- domain
character string to be included in dictionary. Automatically derived for standard ADaM data sets. If not set for
dataprovided, dictionary entry will be 'custom'.
Value
A list containing the following
file,md5the name and md5 checksum, resp., of the file the generated spec is based upon
datathe raw data set if
attach_data,NULLotherwisedata_infoa list containing the number of subjects
nsubjand columnsncolin the data after applyingfiltertypecharacter string
bds, generally giving the type of ADaM data set processed (adsl/bds/occds)filtersubset of
filterthat yields valid and non-empty result when applied individually (usingcheck_filter())idpassing unchanged input
param,label,value,unit,timenames of the key columns to be used in
build_bds()for reshapingspec_idcharacter string, generally the name of the domain
dicta tibble with unique combinations within the
paramandlabelcolumn (if present in the data set) to be used as a data dictionarydupl_ctrla list of length 2 with parameters
values_fnandarrangethat are passed tobuild_bds()to handle pivoting for duplicated values. Both default to NULL.
Details
Values for arguments param, label, unit, time and value will be guessed if not provided.
Guess will be the first of the following options that matches a column name (exact match).
paramPARAMCDlabelPARAMtimeAVISIT,AVISITN,VISIT,VISITNvalueAVAL,AVALCunitAVALU
Function will escape if one of param or value are neither provided nor can be guessed. The other columns are optional.