View source: R/plots-palettesCDISC.R
getPaletteCDISC | R Documentation |
The extraction of the palette elements is case-insensitive.
getPaletteCDISC(x, var, type, palette = NULL)
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. |
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.
Named vector with palette.
Laure Cougnaud
## 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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.