0

I am new to R and I am currently trying to create a choropleth map. My issue is that my breaks do not make sense. What I would like to do is to create breaks that equal:

under 59% 60-69% 70-79% 80-89% over 90%

However what I get instead is:
under 60% 60-70% 70-80% 80-90% over 90%

Does this mean that values=80 are featured in both categories?

My code for creating these breaks is:

colours<-brewer.pal(5,"Blues")

brks<-classIntervals(d.f$var,n=5,style= "fixed", fixedBreaks = 
c(50,60,70,80,90,100))

brks<-brks$brks

plot(d.f,col=colours[findInterval(d.f$var,brks,all.inside=TRUE)],axes=F)

box()

legend("topleft", legend=leglabs(brks), fill=colours, bty="n")
dcc_777
  • 1
  • 1

1 Answers1

0

findInterval uses left-closed, right-open intervals, as its help page explains, where you can override what happens on both ends. Try for instance:

> findInterval(10, c(0,10,20))
[1] 2

which indicates that 10 belongs to the second interval. For what you would like to do, the problem is in which interval would 69.5% fall?

Edzer Pebesma
  • 3,814
  • 16
  • 26