# Prepare the function:
oneColorEnc.fun <- makeOneColorEncodeFunction( numbers = c( 0.4, 6 ),
colors = c("white", "yellow", "red"),
)
# Encode a vector of numbers as a vector of colors:
colors_as_vector <- oneColorEnc.fun( numbers = c( 0.4, 1.2, 5, 6 ),
output_as = 'vector' )
Run the code above in your browser using DataLab