getPaletteCDISC {clinUtils} | R Documentation |
Get standard palette for typical CDISC variables.
Description
The extraction of the palette elements is case-insensitive.
Usage
getPaletteCDISC(x, var, type, palette = NULL)
Arguments
x |
Character vector of factor with
variable to consider.
The palette is built based on the unique elements
of this vector, or levels if |
var |
String with type of variable, among:
|
type |
String with type of palette:
|
palette |
(optional) Named vector with extra palette, e.g. to specify elements for non-standard categories. This palette is combined with the standard palette. |
Details
The order of the palette depends on the type of the input
variable (x
):
if a factor is specified, the palette is ordered based on its levels
if a character vector is specified, the elements from the internal standard palette are used first, the remaining elements are then sorted alphabetically.
Value
Named vector with palette.
Author(s)
Laure Cougnaud
Examples
## palette for reference range indicator variables
xRIND <- c("LOW", "HIGH", "NORMAL", "NORMAL", "NORMAL", "ABNORMAL")
# get standard palette
getPaletteCDISC(x = xRIND, var = "NRIND", type = "shape")
getPaletteCDISC(x = xRIND, var = "NRIND", type = "color")
# in case extra categories are specified:
xRIND <- c(xRIND, "High Panic")
# the symbols are set to numeric symbols
getPaletteCDISC(xRIND, var = "NRIND", type = "shape")
# use shapePalette to specify symbols for extra categories
getPaletteCDISC(xRIND, var = "NRIND", type = "shape", palette = c("High Panic" = "\u2666"))
# palette is case-insensitive
xRIND <- c("Low", "High", "Normal", "Normal", "Normal")
getPaletteCDISC(xRIND, var = "NRIND", type = "shape")