Calculate Liver-to-Body-Weight ratio Z-Scores for each animal in a given STUDYID from SQLite Database or .xpt Files
Source: R/get_livertobw_score.R
get_livertobw_score.RdThis function computes liver-to-body-weight ratio (livertoBW) of each animal and their corresponding z-scores from study data.
It supports retrieving data from SQLite databases or .xpt files and provides flexible options for output formats.
#' @param studyid Character. STUDYID number. Defaults to NULL.
Required for SQLite databases (use_xpt_file = FALSE).
Must be NULL for .xpt files (use_xpt_file = TRUE).
Usage
get_livertobw_score(
studyid = NULL,
path_db,
fake_study = FALSE,
use_xpt_file = FALSE,
master_compiledata = NULL,
bwzscore_BW = NULL,
return_individual_scores = FALSE,
return_zscore_by_USUBJID = FALSE
)Arguments
- path_db
Character. Path to the SQLite database file or a folder containing
.xptfiles. Mandatory.- fake_study
Logical. Whether the study data is generated by the
SENDsanitizerpackage. Defaults toFALSE.- use_xpt_file
Logical. Whether to retrieve study data from
.xptfiles instead of the SQLite database. Defaults toFALSE.- master_compiledata
Optional, character
Ifmaster_compiledatais not supplied (i.e.,NULL), the function will automatically call theget_compile_datafunction to calculate it.- bwzscore_BW
Optional, data.frame.
ifbwzscore_BWis not supplied (i.e.,NULL), the function will automatically call theget_bw_scorefunction to calculate it.- return_individual_scores
Optional, logical
If TRUE, the function returns individual scores for each domain by averaging the scores of all subjects/animals (USUBJID) in the study. Default isFALSE.- return_zscore_by_USUBJID
Optional, logical
IfTRUE, the function returns Z-scores for each animal/subject byUSUBJID. Default isFALSE.
Value
A data frame containing liver-to-body-weight ratio z-scores:
If
return_individual_scores = TRUE: Returns averaged Z-scores for each domain perstudyid.If
return_zscore_by_USUBJID = TRUE: Returns Z-score for each animal/subject byUSUBJIDfor each domain perstudyid.Otherwise, a summarized BW score for the specified
studyid.
Examples
if (FALSE) { # \dontrun{
# Example 1: Default averaged scores
result <- get_livertobw_score(
studyid = '1234123',
path_db = 'path/to/database.db'
)
head(result)
# Example 2: Individual scores by study
result <- get_livertobw_score(
studyid = '1234123',
path_db = 'path/to/database.db',
return_individual_scores = TRUE
)
head(result)
# Example 3: Z-scores by USUBJID
result <- get_livertobw_score(
studyid = '1234123',
path_db = 'path/to/database.db',
return_zscore_by_USUBJID = TRUE
)
head(result)
} # }