[R-sig-Geo] Too many zero's for the quantile style in the function of 'classIntervals'

Roger Bivand Roger.Bivand at nhh.no
Tue Mar 26 20:11:32 CET 2013


Please never post HTML, it wastes bandwidth and is unnecessary.

If you run quantile() on the same data, you see the same outcome. Maybe 
try a more suitable style?

Roger Bivand

On Tue, 26 Mar 2013, Xing Zhao wrote:

> Hi, all
>  
> This question is a relevant problem for mapping sequential color according to crude rate.
> There are a lot of zero's, so the usual 'classIntervals' function doesn't work.
> A simple example,
>>  library(classInt)
>>  dat <- c(rep(0,4),1,2,3,4)
>>  dat
> [1] 0 0 0 0 1 2 3 4
>>  classIntervals(dat, n = 4, style = 'quantile')
> style: quantile
>   one of 4 possible partitions of this variable into 4 classes
>      [0,0)    [0,0.5) [0.5,2.25)   [2.25,4] 
>          0          4          2          2 
> I intended to categorize the crude rate to 4 groups. But the result turns out to be 3 groups. And this manipulation is related to the subsequent 'findColours' function.
> I know there must be some complex methods to deal with this problem. For instance, extracting the zero's first, 'classIntervals' the remaing. But this would cause trouble to the 'findColours' function.
> I want some simple ones, which can be smoothly connected with the subsequent 'findColours' function.
>  
> Thank you in advance
>  
> Zhao Xing
>

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