r - Using a variable in a manual colour palette -


i've got variable called team

team <- "denver" 

i want use in manual colour scheme.

colours.manual <- c(team = "green", "draw" = "grey", "other team" = "red") 

the problem here colours.manual assigns green team instead of denver.

what need use variable?

thanks

we can use setnames

colours.manual <- setnames(c("green", "grey", "red"), c(team, "draw", "other team")) colours.manual #     denver       draw other team  #    "green"     "grey"      "red"  

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -