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

c# - Class in a list -

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

Jdbc Odbc Driver error -