使用RStudio,我需要知道颜色索引到另一个变量。我把我的代码放在评论中。我的问题是关于最后一部分。
# Create a sequential colour scheme with 7 colours using
# the RColorBrewer package. Use any sequential colour scheme
# with 7 colours from the colorbrewer2.org website. Store
# the colour scheme in a variable called map_colours
map_colours <- c("#8dd3c7", "#ffffb3", "#bebada", "#fb8072", "#80b1d3", "#fdb462", "#b3de69")
# Create a variable called log_change:
log_change <- c(6055, 12785, 745, -455, 2890, 171990, 70, 21000, 820, 4830, 133315)
# Use the colour_numbers <- cut(log_change) and to divide the
#log_change vector into 6 divisions, set the labels = FALSE, and
# store the result in #a variable called colour_numbers
colour_numbers <- cut(log_change, breaks= 6, labels= FALSE)
# To deal with the NA value, I set the 4th value to 0 and then
# add 1 to every value
colour_numbers[4] <- 0
colour_numbers <- colour_numbers + 1
这是我的问题:如何通过使用colour_numbers变量索引颜色向量来创建一个名为census_colours的变量
谢谢
德拉