Link Search Menu Expand Document

Constants

In addition to code utilities, the MDI defines a series of constants that establish common framework behaviors and styles. Many are for internal use, whereas others may be useful in your apps.

The constants defined by the framework are found here:

To make it obvious that these values are constants that should not be changed, the object has the uppercase name CONSTANTS.

App-specific constants

You are free to add to the CONSTANTS list at any place in your app’s code, e.g., in server.R. Just be sure to always add to the list, never replacing either the CONSTANTS list or any of its named elements - doing so will break the framework.

# GOOD
CONSTANTS$myValue <- 123

# VERY BAD !!
CONSTANTS <- list()
CONSTANTS$fileSuffixes <- list()

Consistent plot colors

The framework-defined constant most useful to app developers is plotlyColors, which allows you to access the color values used by the plotly package by simple color name, for a consistent appearance of plots:

# <scriptName>.R
plot( 
    ...,
    col = CONSTANTS$plotlyColors$blue
)