I have a shapefile:
I would like to colour each polygon according to the value it holds. I can do this using the following code:
shapefile$colour =
ifelse(shapefile$Count >= 0 & shapefile$Count <= 40,
"blue",
"red")
However, what I would like to do is to decide on my colour scheme in a data frame and then merge this onto the shapefile:
shapefile = merge(shapefile, dataframe, by = "Polygon", all.x = TRUE)
When I do this, I do not get the colours I have specified, despite them reading correctly when I check shapefile@data.
Could anyone help me understand why this happens and also if there is any way around it? Thank you!