# Prepare the function:
twoColorEnc.fun <- makeTwoColorEncodeFunction( numbers.1 = c( 0.4, 6 ),
numbers.2 = c(0.6, 20),
colors.1 = c("white", "red"),
colors.2 = c("white", "green" ),
combine_method = "mean" )
# Encode two vectors of numbers as a single vector of colors:
colors_as_vector <- twoColorEnc.fun( numbers.1 = c( 0.4, 1.2, 5, 6 ),
numbers.2 = c( 0.6, 6, 9, 20 ),
output_as = 'vector' )
Run the code above in your browser using DataLab