Skip to contents

This 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 .xpt files. Mandatory.

fake_study

Logical. Whether the study data is generated by the SENDsanitizer package. Defaults to FALSE.

use_xpt_file

Logical. Whether to retrieve study data from .xpt files instead of the SQLite database. Defaults to FALSE.

master_compiledata

Optional, character
If master_compiledata is not supplied (i.e., NULL), the function will automatically call the get_compile_data function to calculate it.

bwzscore_BW

Optional, data.frame.
if bwzscore_BW is not supplied (i.e., NULL), the function will automatically call the get_bw_score function 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 is FALSE.

return_zscore_by_USUBJID

Optional, logical
If TRUE, the function returns Z-scores for each animal/subject by USUBJID. Default is FALSE.

Value

A data frame containing liver-to-body-weight ratio z-scores:

  • If return_individual_scores = TRUE: Returns averaged Z-scores for each domain per studyid.

  • If return_zscore_by_USUBJID = TRUE: Returns Z-score for each animal/subject by USUBJID for each domain per studyid.

  • 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)
} # }