get_d3_colourScale.Rd
This function does a very specific job only needed when working with sankeyD3::sankeyNetwork()
. It converts a named vector with colors as the values to a format that can be passed to the colourScale =
argument in aforementioned function.
get_d3_colourScale(namedvector)
a named character vector where the names are the levels and the values are the respective colors
a string
BioMathR::get_d3_colourScale(c("A" = "blue", "B" = "red"))
#> [1] "d3.scaleOrdinal() .domain([\"A\", \"B\"]) .range([\"blue\", \"red\"])"
# also see here: https://github.com/fbreitwieser/sankeyD3/issues/20#issuecomment-999624150