[R-sig-Geo] function classIntervals {classInt}: arguments over/under/between

Roger Bivand Roger.Bivand at nhh.no
Wed Jun 12 11:43:11 CEST 2013


On Wed, 12 Jun 2013, RINNER Heinrich wrote:

> Hello,
>
> while making some choropleth maps wit R (version 3.0 under Windows7) I 
> ran into an issue with function classIntervals (in package classInt): 
> I'm not able to change the character string value for 
> "over"/"under"/"between" in printed table labels.

The help page for classIntervals() notes that the cutlabels= argument was 
given a default of TRUE at a revision after the first edition of the book 
was published, so the code which used to give fig 3.15 (p. 79) now gives 
labels as returned by the cut() function, and documented there. To get 
back to the original form, use cutlabels=FALSE in methods for 
"classIntervals" objects:

cI <- classIntervals(jenks71$jenks71, n = 5, style = "equal")
print(cI, cutlabels=FALSE)
attr(findColours(cI, pal = 1:5, cutlabels=FALSE), "table")

The under=, over= and between= arguments are respected when 
cutlabels=FALSE.

Hope this clarifies,

Roger

>
> For example:
>> library(classInt)
>> data(jenks71)
>> classIntervals(jenks71$jenks71, n = 5, style = "equal")
> style: equal
>  one of 3,921,225 possible partitions of this variable into 5 classes
>  [15.57,43.516)  [43.516,71.462)  [71.462,99.408) [99.408,127.354)  [127.354,155.3]
>              35               44               17                4                2
>> classIntervals(jenks71$jenks71, n = 5, style = "equal", between = "-")
> style: equal
>  one of 3,921,225 possible partitions of this variable into 5 classes
>  [15.57,43.516)  [43.516,71.462)  [71.462,99.408) [99.408,127.354)  [127.354,155.3]
>              35               44               17                4                2
>
> --> It seems to me that arguments "over"/"under"/"between" are being ignored, setting them has no effect on the output?
>
> I tried with findColours as well, also with no effect:
>> x <- classIntervals(jenks71$jenks71, n=5, style="equal")
>> findColours(x, pal = 1:5, between = "-")
> [...]
> attr(,"table")
>  [15.57,43.516)  [43.516,71.462)  [71.462,99.408) [99.408,127.354)  [127.354,155.3]
>              35               44               17                4                2
>
> I have seen examples (Fig. 3.5 in the book "Applied Spatial Data Analysis with R") where classIntervals has behaved differently (?), so maybe something has changed here, or I am missing something?
> What can I do to make this work?
>
> Kind regards,
> Heinrich.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no



More information about the R-sig-Geo mailing list