getDefaultCaptions: getDefaultCaptions

View source: R/utilities-mapping.R

getDefaultCaptionsR Documentation

getDefaultCaptions

Description

Creates default legend captions by concatenating the values of the data and metaData of variableList variables from data.

Usage

getDefaultCaptions(
  data,
  metaData = NULL,
  variableList = colnames(data),
  sep = "-"
)

Arguments

data

data.frame used for legend caption

metaData

list of lists containing metaData on data

variableList

ordered vector of variables used for specifying the caption

sep

characters separating variables in caption

Value

Factor levels corresponding to the legend captions

Examples


data <- data.frame(
  Population = c("Caucasian", "Asian", "Caucasian", "Asian"),
  Gender = c("Male", "Male", "Female", "Female"),
  Dose = c(50, 100, 100, 50),
  Compound = c("Midazolam", "Midazolam", "Midazolam", "Midazolam")
)

metaData <- list(Dose = list(unit = "mg"))

# Get captions using every variable of data
getDefaultCaptions(data, metaData)

# Get captions using specific variables of data
getDefaultCaptions(data, metaData, variableList = c("Gender", "Population"))

# Get captions separating variables witha space (character " ")
getDefaultCaptions(data, metaData, sep = " ")

Open-Systems-Pharmacology/TLF-Library documentation built on Feb. 8, 2025, 11:22 a.m.