Skip to contents

The get_bw_score function calculates the Body Weight (BW) Z-score for a specified STUDYID using data from a provided database or .xpt files. It supports optional parameters to customize the analysis and offers the flexibility to return individual Z-score by USUBJID (unique subject identifier).

Usage

get_bw_score(
  studyid = NULL,
  path_db,
  fake_study = FALSE,
  use_xpt_file = FALSE,
  master_compiledata = NULL,
  return_individual_scores = FALSE,
  return_zscore_by_USUBJID = FALSE
)

Arguments

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).

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.

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 the calculated BW Z-scores. The structure of the output depends on the provided parameters:

  • 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: Basic usage
get_bw_score(studyid = '1234123', path_db = 'path/to/database.db')

# Example 2: Include individual scores
get_bw_score(studyid = '1234123', path_db = 'path/to/database.db', return_individual_scores = TRUE)

# Example 3: Include z-scores by USUBJID
get_bw_score(studyid = '1234123', path_db = 'path/to/database.db', return_zscore_by_USUBJID = TRUE)
} # }