classIntervals           package:classInt           R Documentation

_C_h_o_o_s_e _u_n_i_v_a_r_i_a_t_e _c_l_a_s_s _i_n_t_e_r_v_a_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     The function provides a uniform interface to finding class
     intervals for continuous numerical variables, for example for
     choosing colours or symbols for plotting. Class intervals are
     non-overlapping, and the classes are left-closed - see
     'findInterval'. Argument values to the style chosen are passed
     through the dot arguments.

_U_s_a_g_e:

     classIntervals(var, n, style = "quantile", rtimes = 3, ...)
     ## S3 method for class 'classIntervals':
     plot(x, pal, ...) 
     ## S3 method for class 'classIntervals':
     print(x, digits = getOption("digits"), ..., under="under", over="over", between="-", cutlabels=FALSE) 
     nPartitions(x) 

_A_r_g_u_m_e_n_t_s:

     var: a continuous numerical variable

       n: number of classes required, if missing, 'nclass.Sturges' is
          used

   style: chosen style: one of "fixed", "sd", "equal", "pretty",
          "quantile", "kmeans", "hclust", "bclust", or "fisher"

  rtimes: number of replications of var to catenate and jitter; may be
          used with styles "kmeans" or "bclust" in case they have
          difficulties reaching a classification

     ...: arguments to be passed to the functions called in each style

       x: "classIntervals" object for printing or plotting

   under: character string value for "under" in printed table labels

    over: character string value for "over" in printed table labels

 between: character string value for "between" in printed table labels

  digits: minimal number of significant digits in printed table labels

cutlabels: use cut-style labels in printed table labels

     pal: a character vector of at least two colour names for colour
          coding the class intervals in an ECDF plot;
          'colorRampPalette' is used internally to create the correct
          number of colours

_D_e_t_a_i_l_s:

     The "fixed" style permits a "classIntervals" object to be
     specified with given breaks, set in the 'fixedBreaks' argument;
     the length of 'fixedBreaks' should be n+1; this style can be used
     to insert rounded break values.

     The "sd" style chooses breaks based on 'pretty' of the centred and
     scaled variables, and may have a number of classes different from
     n; the returned 'par=' includes the centre and scale values.

     The "equal" style divides the range of the variable into n parts.

     The "pretty" style chooses a number of breaks not necessarily
     equal to n using 'pretty', but likely to be legible; arguments to
     'pretty' may be passed through '...'.

     The "quantile" style provides quantile breaks; arguments to
     'quantile' may be passed through '...'.

     The "kmeans" style uses 'kmeans' to generate the breaks; it may be
     anchored using 'set.seed'; the 'pars' attribute returns the kmeans
     object generated; if 'kmeans' fails, a jittered input vector
     containing 'rtimes' replications of 'var' is tried - with few
     unique values in 'var', this can prove necessary; arguments to
     'kmeans' may be passed through '...'.

     The "hclust" style uses 'hclust' to generate the breaks using
     hierarchical clustering; the 'pars' attribute returns the hclust
     object generated, and can be used to find other breaks using
     'getHclustClassIntervals'; arguments to 'hclust' may be passed
     through '...'.

     The "bclust" style uses 'bclust' to generate the breaks using
     bagged clustering; it may be anchored using 'set.seed'; the 'pars'
     attribute returns the bclust object generated, and can be used to
     find other breaks using 'getBclustClassIntervals'; if 'bclust'
     fails, a jittered input vector containing 'rtimes' replications of
     'var' is tried - with few unique values in 'var', this can prove
     necessary; arguments to 'bclust' may be passed through '...'.

     The "fisher" style uses the algorithm proposed by W. D. Fisher
     (1958) and discussed by Slocum et al. (2005) as the Fisher-Jenks
     algorithm; added here thanks to Hisaji Ono.

_V_a_l_u_e:

     an object of class "classIntervals": 

     var: the input variable

    brks: a vector of breaks

   style: the style used

parameters: parameter values used in finding breaks

    nobs: number of different finite values in the input variable

    call: this function's call

_A_u_t_h_o_r(_s):

     Roger Bivand <Roger.Bivand@nhh.no>

_R_e_f_e_r_e_n_c_e_s:

     Armstrong, M. P., Xiao, N., Bennett, D. A., 2003. "Using genetic
     algorithms to create multicriteria class intervals for choropleth
     maps". Annals, Association of American Geographers, 93 (3),
     595-623; Jenks, G. F., Caspall, F. C., 1971. "Error on
     choroplethic maps: definition, measurement, reduction". Annals,
     Association of American Geographers, 61 (2), 217-244; Dent, B. D.,
     1999, Cartography: thematic map design. McGraw-Hill, Boston, 417
     pp.; Slocum TA, McMaster RB, Kessler FC, Howard HH 2005 Thematic
     Cartography and Geographic Visualizatio, Prentice Hall, Upper
     Saddle River NJ.; Fisher, W. D. 1958 "On grouping for maximum
     homogeneity", Journal of the American Statistical Association, 53,
     pp. 789-798 (<URL:
     http://lib.stat.cmu.edu/cmlib/src/cluster/fish.f>)

_S_e_e _A_l_s_o:

     'pretty', 'quantile', 'kmeans', 'hclust', 'bclust',
     'findInterval', 'colorRampPalette', 'nclass.Sturges'

_E_x_a_m_p_l_e_s:

     data(jenks71)
     pal1 <- c("wheat1", "red3")
     opar <- par(mfrow=c(3,3))
     plot(classIntervals(jenks71$jenks71, n=5, style="fixed", fixedBreaks=c(15.57, 25, 50, 75, 100, 155.30)), pal=pal1, main="Fixed")
     plot(classIntervals(jenks71$jenks71, n=5, style="sd"), pal=pal1, main="Pretty standard deviations")
     plot(classIntervals(jenks71$jenks71, n=5, style="equal"), pal=pal1, main="Equal intervals")
     plot(classIntervals(jenks71$jenks71, n=5, style="quantile"), pal=pal1, main="Quantile")
     set.seed(1)
     plot(classIntervals(jenks71$jenks71, n=5, style="kmeans"), pal=pal1, main="K-means")
     plot(classIntervals(jenks71$jenks71, n=5, style="hclust", method="complete"), pal=pal1, main="Complete cluster")
     plot(classIntervals(jenks71$jenks71, n=5, style="hclust", method="single"), pal=pal1, main="Single cluster")
     set.seed(1)
     plot(classIntervals(jenks71$jenks71, n=5, style="bclust", verbose=FALSE), pal=pal1, main="Bagged cluster")
     plot(classIntervals(jenks71$jenks71, n=5, style="fisher"), pal=pal1, main="Fisher's method")
     par(opar)
     classIntervals(jenks71$jenks71, n=5, style="fixed", fixedBreaks=c(15.57, 25, 50, 75, 100, 155.30))
     classIntervals(jenks71$jenks71, n=5, style="sd")
     classIntervals(jenks71$jenks71, n=5, style="equal")
     classIntervals(jenks71$jenks71, n=5, style="quantile")
     set.seed(1)
     classIntervals(jenks71$jenks71, n=5, style="kmeans")
     classIntervals(jenks71$jenks71, n=5, style="hclust", method="complete")
     classIntervals(jenks71$jenks71, n=5, style="hclust", method="single")
     set.seed(1)
     classIntervals(jenks71$jenks71, n=5, style="bclust", verbose=FALSE)
     classIntervals(jenks71$jenks71, n=5, style="bclust", hclust.method="complete", verbose=FALSE)
     classIntervals(jenks71$jenks71, n=5, style="fisher")

