The colors()
function in R is used to return all the built-in color names in R.
colors(distinct = FALSE)colours(distinct = FALSE)
Note: Thecolors()
function can also be interchanged with thecolours()
function.
The colors()
function takes a single parameter value, distinct
, which takes a Boolean value of either TRUE
or FALSE
.
The colors()
function returns a character vector that contains all the built-in color names in R.
# Getting all the built-in colors in Rcolors(distinct=FALSE)
# Getting all the built-in distinc colors in Rcolors(distinct=TRUE)
The distinct
parameter indicates whether the colors returned are distinct or not, for example, "snow"
and "snow1"
are effectively the same point in the FALSE
.