简体   繁体   English

R空间映射:使用类间隔函数创建间隔

[英]R Spatial mapping: Creating intevals using the class interval function

I am new to R and I am currently trying to create a choropleth map. 我是R的新手,目前正在尝试创建一个Choropleth贴图。 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% 低于59%60-69%70-79%80-89%高于90%

However what I get instead is: 但是我得到的是:
under 60% 60-70% 70-80% 80-90% over 90% 低于60%60-70%70-80%80-90%超过90%

Does this mean that values=80 are featured in both categories? 这是否意味着在两个类别中都具有值= 80?

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")

findInterval uses left-closed, right-open intervals, as its help page explains, where you can override what happens on both ends. findInterval使用左,右打开间隔,如其帮助页面所述,您可以在其中覆盖两端发生的情况。 Try for instance: 例如尝试:

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

which indicates that 10 belongs to the second interval. 表示10属于第二个间隔。 For what you would like to do, the problem is in which interval would 69.5% fall? 对于您要执行的操作,问题在于69.5%下降间隔是多少?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM