I am struggling trying to generate a specific color palette to be used in a network for coloring edges. I have created a simple example:
library(RColorBrewer) w = runif(100, min=-1, max=1) colors = RColorBrewer::brewer.pal(n=10, name="RdYlBu")[as.numeric(as.factor(w))]
I would like to classify all that continuous values between -1 and 1, generating a color palette of 10 different colors. However, lots of NAs are generated.
Why is this happening?
Thanks in advance for any help!