1
似乎我無法在第一次嘗試時使用功能調色板(rainbow())更新顏色,但在第二次嘗試時成功。有更聰明的方法來更新顏色,而不是我的方式來調用該函數兩次?R:調色板(彩虹())沒有爲第一次嘗試更新
# call the function
colRainbow = palette(rainbow(3))
colRainbow
# [1] "red" "green" "blue"
# success!
# call the function, overwrite the object colRainbow
colRainbow = palette(rainbow(5))
colRainbow
# [1] "red" "green" "blue"
# Fail!
# Re-overwrite the object
colRainbow = palette(rainbow(5))
colRainbow
# [1] "red" "#CCFF00" "#00FF66" "#0066FF" "#CC00FF"
# success!
相關 - https://stackoverflow.com/questions/35734705/colors-incorrect-on-first-execution-of-code/35735749 – thelatemail