I am not sure whether this has to do something with integer values by which I want to do the switch or I am just using switch entirely wrong. States is vector consisting of 1 / 0 / -1. My goal is to replace 1s with blue, etc...
color_vertexFrame <- switch( States,
1 <- "blue",
0 <- "grey",
-1 <- "red")
Error in switch(States, 1 <- "blue", 0 <- "grey", -1 <- "red") :
EXPR must be a length 1 vector
Before I had in States
only 1 or -1 so this line worked well :
color_vertexFrame <- ifelse(States == 1, "blue", "red")
I would like to do now something similar only with 3 values.
Thank you