diff --git a/DESCRIPTION b/DESCRIPTION index 61aca51..2ef30b6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: classInt Version: 0.4-10 -Date: 2023-08-15 +Date: 2023-08-24 Title: Choose Univariate Class Intervals Authors@R: c( person("Roger", "Bivand", role=c("aut", "cre"), email="Roger.Bivand@nhh.no", comment=c(ORCID="0000-0003-2392-6140")), diff --git a/R/classInt.R b/R/classInt.R index a99f737..37ba36a 100644 --- a/R/classInt.R +++ b/R/classInt.R @@ -132,11 +132,13 @@ classIntervals <- function(var, n, style="quantile", rtimes=3, ..., intervalClos # introduced related to https://github.com/r-spatial/classInt/issues/7 sampling <- FALSE if (warnLargeN && - (style %in% c("kmeans", "hclust", "bclust", "fisher", "jenks"))) { + (style %in% c("fisher", "jenks"))) { if (nobs > largeN) { warning("N is large, and some styles will run very slowly; sampling imposed") sampling <- TRUE - nsamp <- ifelse(samp_prop*nobs > 3000, as.integer(ceiling(samp_prop*nobs)), 3000L) +# issue 44 + nsamp <- as.integer(ceiling(samp_prop*nobs)) + if (nsamp > largeN) nsamp <- as.integer(largeN) } } if (style =="fixed") { diff --git a/docs/404.html b/docs/404.html index dda3227..7afb842 100644 --- a/docs/404.html +++ b/docs/404.html @@ -32,7 +32,7 @@ classInt - 0.4-8 + 0.4-10 @@ -100,7 +100,7 @@

Page not found (404)

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/articles/headtailsR.html b/docs/articles/headtailsR.html index 9e5f1ea..b8f9528 100644 --- a/docs/articles/headtailsR.html +++ b/docs/articles/headtailsR.html @@ -33,7 +33,7 @@ classInt - 0.4-8 + 0.4-10 @@ -79,9 +79,10 @@
diff --git a/docs/articles/headtailsR_files/figure-html/benchmarkbreaks-1.png b/docs/articles/headtailsR_files/figure-html/benchmarkbreaks-1.png index 29cab0c..cc34875 100644 Binary files a/docs/articles/headtailsR_files/figure-html/benchmarkbreaks-1.png and b/docs/articles/headtailsR_files/figure-html/benchmarkbreaks-1.png differ diff --git a/docs/articles/headtailsR_files/figure-html/breaksample-1.png b/docs/articles/headtailsR_files/figure-html/breaksample-1.png index 2b84310..91a0ae4 100644 Binary files a/docs/articles/headtailsR_files/figure-html/breaksample-1.png and b/docs/articles/headtailsR_files/figure-html/breaksample-1.png differ diff --git a/docs/articles/headtailsR_files/figure-html/breaksample-2.png b/docs/articles/headtailsR_files/figure-html/breaksample-2.png index bda2a35..b6a5a1e 100644 Binary files a/docs/articles/headtailsR_files/figure-html/breaksample-2.png and b/docs/articles/headtailsR_files/figure-html/breaksample-2.png differ diff --git a/docs/articles/headtailsR_files/figure-html/breaksample-3.png b/docs/articles/headtailsR_files/figure-html/breaksample-3.png index 19b8682..7b1b6bb 100644 Binary files a/docs/articles/headtailsR_files/figure-html/breaksample-3.png and b/docs/articles/headtailsR_files/figure-html/breaksample-3.png differ diff --git a/docs/articles/headtailsR_files/figure-html/charheavytail-1.png b/docs/articles/headtailsR_files/figure-html/charheavytail-1.png index 337ca68..05d73af 100644 Binary files a/docs/articles/headtailsR_files/figure-html/charheavytail-1.png and b/docs/articles/headtailsR_files/figure-html/charheavytail-1.png differ diff --git a/docs/articles/headtailsR_files/figure-html/charheavytail-2.png b/docs/articles/headtailsR_files/figure-html/charheavytail-2.png index b4a0263..cbe17b9 100644 Binary files a/docs/articles/headtailsR_files/figure-html/charheavytail-2.png and b/docs/articles/headtailsR_files/figure-html/charheavytail-2.png differ diff --git a/docs/articles/headtailsR_files/figure-html/examplesimp-1.png b/docs/articles/headtailsR_files/figure-html/examplesimp-1.png index 1bddbaa..62e055d 100644 Binary files a/docs/articles/headtailsR_files/figure-html/examplesimp-1.png and b/docs/articles/headtailsR_files/figure-html/examplesimp-1.png differ diff --git a/docs/articles/headtailsR_files/figure-html/examplesimp-2.png b/docs/articles/headtailsR_files/figure-html/examplesimp-2.png index 5bead34..f73fe90 100644 Binary files a/docs/articles/headtailsR_files/figure-html/examplesimp-2.png and b/docs/articles/headtailsR_files/figure-html/examplesimp-2.png differ diff --git a/docs/articles/headtailsR_files/figure-html/examplesimp-3.png b/docs/articles/headtailsR_files/figure-html/examplesimp-3.png index 23395b5..6d5e69a 100644 Binary files a/docs/articles/headtailsR_files/figure-html/examplesimp-3.png and b/docs/articles/headtailsR_files/figure-html/examplesimp-3.png differ diff --git a/docs/articles/headtailsR_files/figure-html/examplesimp-4.png b/docs/articles/headtailsR_files/figure-html/examplesimp-4.png index a540314..57d2ec1 100644 Binary files a/docs/articles/headtailsR_files/figure-html/examplesimp-4.png and b/docs/articles/headtailsR_files/figure-html/examplesimp-4.png differ diff --git a/docs/articles/headtailsR_files/figure-html/finalplot -1.png b/docs/articles/headtailsR_files/figure-html/finalplot -1.png index 7cefd97..4264d8a 100644 Binary files a/docs/articles/headtailsR_files/figure-html/finalplot -1.png and b/docs/articles/headtailsR_files/figure-html/finalplot -1.png differ diff --git a/docs/articles/headtailsR_files/figure-html/finalplot -2.png b/docs/articles/headtailsR_files/figure-html/finalplot -2.png index 8f5d08d..9047c7b 100644 Binary files a/docs/articles/headtailsR_files/figure-html/finalplot -2.png and b/docs/articles/headtailsR_files/figure-html/finalplot -2.png differ diff --git a/docs/articles/headtailsR_files/figure-html/finalplot -3.png b/docs/articles/headtailsR_files/figure-html/finalplot -3.png index 753b29b..0b1441d 100644 Binary files a/docs/articles/headtailsR_files/figure-html/finalplot -3.png and b/docs/articles/headtailsR_files/figure-html/finalplot -3.png differ diff --git a/docs/articles/headtailsR_files/figure-html/finalplot -4.png b/docs/articles/headtailsR_files/figure-html/finalplot -4.png index 868e80d..4003cbb 100644 Binary files a/docs/articles/headtailsR_files/figure-html/finalplot -4.png and b/docs/articles/headtailsR_files/figure-html/finalplot -4.png differ diff --git a/docs/articles/headtailsR_files/figure-html/stepbystep-1.png b/docs/articles/headtailsR_files/figure-html/stepbystep-1.png index 7db8037..def1cc0 100644 Binary files a/docs/articles/headtailsR_files/figure-html/stepbystep-1.png and b/docs/articles/headtailsR_files/figure-html/stepbystep-1.png differ diff --git a/docs/articles/headtailsR_files/figure-html/stepbystep-2.png b/docs/articles/headtailsR_files/figure-html/stepbystep-2.png index 274ec67..3c650da 100644 Binary files a/docs/articles/headtailsR_files/figure-html/stepbystep-2.png and b/docs/articles/headtailsR_files/figure-html/stepbystep-2.png differ diff --git a/docs/articles/headtailsR_files/figure-html/stepbystep-3.png b/docs/articles/headtailsR_files/figure-html/stepbystep-3.png index 1a29909..78d1c35 100644 Binary files a/docs/articles/headtailsR_files/figure-html/stepbystep-3.png and b/docs/articles/headtailsR_files/figure-html/stepbystep-3.png differ diff --git a/docs/articles/headtailsR_files/figure-html/stepbystep-4.png b/docs/articles/headtailsR_files/figure-html/stepbystep-4.png index 8a14158..5924bd1 100644 Binary files a/docs/articles/headtailsR_files/figure-html/stepbystep-4.png and b/docs/articles/headtailsR_files/figure-html/stepbystep-4.png differ diff --git a/docs/articles/headtailsR_files/figure-html/summspdata-1.png b/docs/articles/headtailsR_files/figure-html/summspdata-1.png index 76332ab..fba42cd 100644 Binary files a/docs/articles/headtailsR_files/figure-html/summspdata-1.png and b/docs/articles/headtailsR_files/figure-html/summspdata-1.png differ diff --git a/docs/articles/headtailsR_files/figure-html/summspdata-2.png b/docs/articles/headtailsR_files/figure-html/summspdata-2.png index 333615f..56b138d 100644 Binary files a/docs/articles/headtailsR_files/figure-html/summspdata-2.png and b/docs/articles/headtailsR_files/figure-html/summspdata-2.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-1.png b/docs/articles/headtailsR_files/figure-html/testresults-1.png index 7d2cf8a..410e5b9 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-1.png and b/docs/articles/headtailsR_files/figure-html/testresults-1.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-10.png b/docs/articles/headtailsR_files/figure-html/testresults-10.png index f5d005f..bc440b9 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-10.png and b/docs/articles/headtailsR_files/figure-html/testresults-10.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-11.png b/docs/articles/headtailsR_files/figure-html/testresults-11.png index 647bd75..dbdd836 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-11.png and b/docs/articles/headtailsR_files/figure-html/testresults-11.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-12.png b/docs/articles/headtailsR_files/figure-html/testresults-12.png index 68f0e82..1bb6819 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-12.png and b/docs/articles/headtailsR_files/figure-html/testresults-12.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-13.png b/docs/articles/headtailsR_files/figure-html/testresults-13.png index a0e217c..03f59ad 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-13.png and b/docs/articles/headtailsR_files/figure-html/testresults-13.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-14.png b/docs/articles/headtailsR_files/figure-html/testresults-14.png index c04abc5..ecd4286 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-14.png and b/docs/articles/headtailsR_files/figure-html/testresults-14.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-2.png b/docs/articles/headtailsR_files/figure-html/testresults-2.png index 3b7d662..2bbdd9f 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-2.png and b/docs/articles/headtailsR_files/figure-html/testresults-2.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-3.png b/docs/articles/headtailsR_files/figure-html/testresults-3.png index c70042f..80dcabb 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-3.png and b/docs/articles/headtailsR_files/figure-html/testresults-3.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-4.png b/docs/articles/headtailsR_files/figure-html/testresults-4.png index a783303..de3d23c 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-4.png and b/docs/articles/headtailsR_files/figure-html/testresults-4.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-5.png b/docs/articles/headtailsR_files/figure-html/testresults-5.png index 98f537b..4d907be 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-5.png and b/docs/articles/headtailsR_files/figure-html/testresults-5.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-6.png b/docs/articles/headtailsR_files/figure-html/testresults-6.png index 339a84b..fceee4d 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-6.png and b/docs/articles/headtailsR_files/figure-html/testresults-6.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-7.png b/docs/articles/headtailsR_files/figure-html/testresults-7.png index 94ef1bf..20ab9fe 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-7.png and b/docs/articles/headtailsR_files/figure-html/testresults-7.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-8.png b/docs/articles/headtailsR_files/figure-html/testresults-8.png index 8cfc7af..a08708f 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-8.png and b/docs/articles/headtailsR_files/figure-html/testresults-8.png differ diff --git a/docs/articles/headtailsR_files/figure-html/testresults-9.png b/docs/articles/headtailsR_files/figure-html/testresults-9.png index 40900f2..159bc15 100644 Binary files a/docs/articles/headtailsR_files/figure-html/testresults-9.png and b/docs/articles/headtailsR_files/figure-html/testresults-9.png differ diff --git a/docs/articles/index.html b/docs/articles/index.html index 8f98fb6..2408277 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -17,7 +17,7 @@ classInt - 0.4-8 + 0.4-10
@@ -72,7 +72,7 @@

All vignettes

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/authors.html b/docs/authors.html index 8b7b4d0..3b0292c 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -17,7 +17,7 @@ classInt - 0.4-8 + 0.4-10 @@ -95,14 +95,14 @@

Citation

-

Bivand R (2022). +

Bivand R (2023). classInt: Choose Univariate Class Intervals. https://r-spatial.github.io/classInt/, https://github.com/r-spatial/classInt/.

@Manual{,
   title = {classInt: Choose Univariate Class Intervals},
   author = {Roger Bivand},
-  year = {2022},
+  year = {2023},
   note = {https://r-spatial.github.io/classInt/, https://github.com/r-spatial/classInt/},
 }
@@ -117,7 +117,7 @@

Citation

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/index.html b/docs/index.html index c62bc47..a90bf1f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -33,7 +33,7 @@ classInt - 0.4-8 + 0.4-10 @@ -80,7 +80,7 @@
- +

Actions Status CRAN

Choose Univariate Class Intervals

Selected commonly used methods for choosing univariate class intervals for mapping or other graphics purposes. From 0.4-3, an implementation of the “headtails” style contributed by Diego Hernangómez - Jiang, B. 2013 “Head/tail breaks: A new classification scheme for data with a heavy-tailed distribution”, The Professional Geographer, 65 (3), 482 – 494. https://arxiv.org/abs/1209.2801v1. From 0.4-7, an implementation of the “maximum” style contributed by Josiah Parry. From 0.4-8, an implementation of the “box” style contributed by Angela Li and Diego Hernangómez.

@@ -125,13 +125,7 @@

Developers

-
-

Dev status

-
    -
  • Actions Status
  • -
  • CRAN
  • -
-
+
@@ -144,7 +138,7 @@

Dev status

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/news/index.html b/docs/news/index.html index cc68d76..cf5cdb7 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -17,7 +17,7 @@ classInt - 0.4-8 + 0.4-10 @@ -58,8 +58,13 @@

Changelog

- -
  • #18 and #38: classIntervals() has a new style "box", where a box map is an augmented quartile map, with an additional lower and upper category. When there are lower outliers, then the starting point for the breaks is the minimum value, and the second break is the lower fence. When there are no lower outliers, then the starting point for the breaks will be the lower fence, and the second break is the minimum value (there will be no observations that fall in the interval between the lower fence and the minimum value) (@angela-li, @dieghernan).
+ +
  • #41 issues. The maximum and minimum breaks are set to and to avoid errors induced in the earlier version where breaks could cease to be strictly ascending. The argument with value may be used to revert to the previous behaviour.
  • +
+
+ +
  • #18 and #38: classIntervals() has a new style "box", where a box map is an augmented quartile map, with an additional lower and upper category. When there are lower outliers, then the starting point for the breaks is the minimum value, and the second break is the lower fence. When there are no lower outliers, then the starting point for the breaks will be the lower fence, and the second break is the minimum value (there will be no observations that fall in the interval between the lower fence and the minimum value) (@angela-li, @dieghernan).
  • +
  • A new helper function classify_intervals() is introduced to return a vector of class intervals of same length as input (@JosiahParry)
  • @@ -88,7 +93,7 @@
diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 4c8d951..cc989b6 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -1,7 +1,7 @@ -pandoc: 2.14.0.3 -pkgdown: 2.0.6 +pandoc: 2.19.2 +pkgdown: 2.0.7 pkgdown_sha: ~ articles: headtailsR: headtailsR.html -last_built: 2022-09-23T08:44Z +last_built: 2023-08-29T09:19Z diff --git a/docs/reference/Rplot002.png b/docs/reference/Rplot002.png index 48d663e..85915d8 100644 Binary files a/docs/reference/Rplot002.png and b/docs/reference/Rplot002.png differ diff --git a/docs/reference/Rplot003.png b/docs/reference/Rplot003.png index 90e2dc3..2c2cd54 100644 Binary files a/docs/reference/Rplot003.png and b/docs/reference/Rplot003.png differ diff --git a/docs/reference/Rplot004.png b/docs/reference/Rplot004.png index 3fa334d..24be438 100644 Binary files a/docs/reference/Rplot004.png and b/docs/reference/Rplot004.png differ diff --git a/docs/reference/classIntervals-1.png b/docs/reference/classIntervals-1.png index 8c5ca0b..00d05f2 100644 Binary files a/docs/reference/classIntervals-1.png and b/docs/reference/classIntervals-1.png differ diff --git a/docs/reference/classIntervals-2.png b/docs/reference/classIntervals-2.png index ce14eb4..17f6422 100644 Binary files a/docs/reference/classIntervals-2.png and b/docs/reference/classIntervals-2.png differ diff --git a/docs/reference/classIntervals-3.png b/docs/reference/classIntervals-3.png index c1c7b86..e2c151a 100644 Binary files a/docs/reference/classIntervals-3.png and b/docs/reference/classIntervals-3.png differ diff --git a/docs/reference/classIntervals-4.png b/docs/reference/classIntervals-4.png index be1308f..83518af 100644 Binary files a/docs/reference/classIntervals-4.png and b/docs/reference/classIntervals-4.png differ diff --git a/docs/reference/classIntervals.html b/docs/reference/classIntervals.html index ada1bdf..4034d50 100644 --- a/docs/reference/classIntervals.html +++ b/docs/reference/classIntervals.html @@ -17,7 +17,7 @@ classInt - 0.4-8 + 0.4-10 @@ -71,7 +71,7 @@

Choose univariate class intervals

plot(x, pal, ...) # S3 method for classIntervals print(x, digits = getOption("digits"), ..., - under="under", over="over", between="-", cutlabels=TRUE, unique=FALSE) + under="under", over="over", between="-", cutlabels=TRUE, unique=FALSE,big.mark=NULL) nPartitions(x) classIntervals2shingle(x)
@@ -85,7 +85,7 @@

Arguments

number of classes required, if missing, nclass.Sturges is used; see also the "dpih" and "headtails" styles for automatic choice of the number of classes

style
-

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

+

chosen style: one of "fixed", "sd", "equal", "pretty", "quantile", "kmeans", "hclust", "bclust", "fisher", "jenks", "dpih", "headtails", "maximum", or "box"

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

@@ -103,7 +103,7 @@

Arguments

default TRUE, if FALSE large data handling not used

largeN
-

default 3000L, the QGIS sampling threshold; over 3000, the observations presented to "fisher" and "jenks" are either a samp_prop= sample or a sample of 3000, whichever is larger

+

default 3000L, the QGIS sampling threshold; if warnLargeNis TRUE and the number of observations is greater than largeN, the observations presented to "fisher" and "jenks" are either a samp_prop= sample of the observations, or a sample of largeN, whichever is smaller

samp_prop

default 0.1, QGIS 10% sampling proportion

@@ -135,6 +135,9 @@

Arguments

unique

default FALSE; if TRUE, collapse labels of single-value classes

+
big.mark
+

default NULL; an object of class character to specify to 'thousands' separator

+
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

@@ -154,7 +157,7 @@

Details

The "dpih" style uses the dpih() function from KernSmooth (Wand, 1995) implementing direct plug-in methodology to select the bin width of a histogram.

The "headtails" style uses the algorithm proposed by Bin Jiang (2013), in order to find groupings or hierarchy for data with a heavy-tailed distribution. This classification scheme partitions all of the data values around the mean into two parts and continues the process iteratively for the values (above the mean) in the head until the head part values are no longer heavy-tailed distributed. Thus, the number of classes and the class intervals are both naturally determined. By default the algorithm uses thr = 0.4, meaning that when the head represents more than 40% of the observations the distribution is not considered heavy-tailed. The threshold argument thr may be modified through ... (see Examples).

The "maximum" style uses the Maximum Breaks method of classification finding the k - 1 largest differences in var. The mean of the values that generated the largest splits is used as the interval boundary.

-

The "box" style generates 7 breaks (therefore 6 categories) based on a box-and-whisker plot. First and last categories include the data values considered as outliers, and the four remaining categories are defined by the percentiles 25, 50 and 75 of the data distribution. By default, the identification of outliers is based on the interquantile range (IQR), so values lower than percentile 25 - 1.5 * IQR or higher than percentile 75 + 1.5 * IQR are considered as outliers. The multiplier applied to the IQR iqr_mult = 1.5 may be modified through .... As in the "quantile" style, the type= argument may be used to choose the quantile algoritm (default 7).

+

The "box" style generates 7 breaks (therefore 6 categories) based on a box-and-whisker plot. First and last categories include the data values considered as outliers, and the four remaining categories are defined by the percentiles 25, 50 and 75 of the data distribution. By default, the identification of outliers is based on the interquantile range (IQR), so values lower than percentile 25 - 1.5 * IQR or higher than percentile 75 + 1.5 * IQR are considered as outliers. The multiplier applied to the IQR iqr_mult = 1.5 may be modified through ...; the value must not be negative. As in the "quantile" style, the type= argument may be used to choose the quantile algoritm (default 7, standard boxplots use 5 or 2). From 0.4-9 and #41, the maximum and minimum are set to +Inf and -Inf to avoid errors induced in the earlier version where breaks could cease to be strictly ascending. The legacy= argument with value TRUE may be used to revert to the previous behaviour.

Value

@@ -218,6 +221,12 @@

Examples

} else { run <- TRUE } +#> The legacy packages maptools, rgdal, and rgeos, underpinning the sp package, +#> which was just load ed, were retired in October 2023. +#> Please refer to R-spatial evolution reports for details, especially +#> https://r-spatial.org/r/2023/05/15/evolution4.html. +#> It may be desirable to make the sf package available; +#> package maintainers should consider adding sf to Suggests:. if (run) { data(jenks71, package="spData") pal1 <- c("wheat1", "red3") @@ -416,10 +425,10 @@

Examples

} #> style: box #> one of 75,287,520 possible partitions of this variable into 6 classes -#> [-8.02125,15) [15,37.7325) [37.7325,53.33) [53.33,68.235) -#> 0 26 25 25 -#> [68.235,113.9887) [113.9887,155.3] -#> 22 4 +#> [-Inf,-8.02125) [-8.02125,37.7325) [37.7325,53.33) [53.33,68.235) +#> 0 26 25 25 +#> [68.235,113.9887) [113.9887,155.3] +#> 22 4 if (run) { print(classIntervals(jenks71$jenks71, style="box", iqr_mult = 0.25)) } @@ -461,82 +470,30 @@

Examples

#> 0 (0,19.5] (19.5,20.63] (20.63,22.6] 26 #> 10 33 39 28 10 -# \dontrun{ +if (FALSE) { set.seed(1) n <- 1e+05 x <- runif(n) classIntervals(x, n=5, style="sd") -#> style: sd -#> [-0.07925682,0.06546355) [0.06546355,0.2101839) [0.2101839,0.3549043) -#> 6597 14579 14403 -#> [0.3549043,0.4996247) [0.4996247,0.644345) [0.644345,0.7890654) -#> 14395 14446 14439 -#> [0.7890654,0.9337858) [0.9337858,1.078506] -#> 14463 6678 classIntervals(x, n=5, style="pretty") -#> style: pretty -#> [0,0.2) [0.2,0.4) [0.4,0.6) [0.6,0.8) [0.8,1] -#> 20142 19936 19888 19993 20041 classIntervals(x, n=5, style="equal") -#> style: equal -#> [3.895489e-06,0.1999925) [0.1999925,0.3999812) [0.3999812,0.5999698) -#> 20141 19935 19888 -#> [0.5999698,0.7999584) [0.7999584,0.9999471] -#> 19991 20045 classIntervals(x, n=5, style="quantile") -#> style: quantile -#> [3.895489e-06,0.1984408) [0.1984408,0.3993007) [0.3993007,0.6003913) -#> 20000 20000 20000 -#> [0.6003913,0.8003984) [0.8003984,0.9999471] -#> 20000 20000 # the class intervals found vary a little because of sampling classIntervals(x, n=5, style="kmeans") -#> Warning: N is large, and some styles will run very slowly; sampling imposed -#> style: kmeans -#> [3.895489e-06,0.1992885) [0.1992885,0.4002208) [0.4002208,0.600954) -#> 20075 20034 19946 -#> [0.600954,0.800892) [0.800892,0.9999471] -#> 20007 19938 classIntervals(x, n=5, style="fisher") -#> Warning: N is large, and some styles will run very slowly; sampling imposed -#> style: fisher -#> [3.895489e-06,0.1969869) [0.1969869,0.394688) [0.394688,0.595018) -#> 19860 19690 19893 -#> [0.595018,0.7967174) [0.7967174,0.9999471] -#> 20194 20363 classIntervals(x, n=5, style="fisher") -#> Warning: N is large, and some styles will run very slowly; sampling imposed -#> style: fisher -#> [3.895489e-06,0.1887506) [0.1887506,0.3856013) [0.3856013,0.5868507) -#> 19036 19653 19966 -#> [0.5868507,0.7925222) [0.7925222,0.9999471] -#> 20553 20792 classIntervals(x, n=5, style="fisher") -#> Warning: N is large, and some styles will run very slowly; sampling imposed -#> style: fisher -#> [3.895489e-06,0.1974303) [0.1974303,0.3969872) [0.3969872,0.5978375) -#> 19912 19832 19987 -#> [0.5978375,0.7994717) [0.7994717,0.9999471] -#> 20166 20103 -# } +} have_units <- FALSE -if (require(units, quietly=TRUE)) have_units <- TRUE +if (require(units, quietly=TRUE)) have_units <- TRUE #> udunits database from /usr/share/udunits/udunits2.xml if (have_units) { set.seed(1) -x_units <- set_units(sample(seq(1, 100, 0.25), 100), km/h) -# \dontrun{ +x_units <- set_units(sample(seq(1, 100, 0.25), 100), km/h) +if (FALSE) { classIntervals(x_units, n=5, style="sd") -# } } -#> style: sd -#> one of 14,887,031,544 possible partitions of this [km/h] variable into 8 classes -#> [-6.990949,7.637413) [7.637413,22.26578) [22.26578,36.89414) -#> 6 15 16 -#> [36.89414,51.5225) [51.5225,66.15086) [66.15086,80.77922) -#> 12 12 16 -#> [80.77922,95.40759) [95.40759,110.0359] -#> 18 5 +} if (have_units) { classIntervals(x_units, n=5, style="pretty") } @@ -545,14 +502,10 @@

Examples

#> [0,20) [20,40) [40,60) [60,80) [80,100] #> 18 21 19 19 23 if (have_units) { -# \dontrun{ +if (FALSE) { classIntervals(x_units, n=5, style="equal") -# } } -#> style: equal -#> one of 3,764,376 possible partitions of this [km/h] variable into 5 classes -#> [4,23.1) [23.1,42.2) [42.2,61.3) [61.3,80.4) [80.4,99.5] -#> 22 19 17 19 23 +} if (have_units) { classIntervals(x_units, n=5, style="quantile") } @@ -561,14 +514,10 @@

Examples

#> [4,21.95) [21.95,41.5) [41.5,64.05) [64.05,82.8) [82.8,99.5] #> 20 20 20 20 20 if (have_units) { -# \dontrun{ +if (FALSE) { classIntervals(x_units, n=5, style="kmeans") -# } } -#> style: kmeans -#> one of 3,764,376 possible partitions of this [km/h] variable into 5 classes -#> [4,19.375) [19.375,39.375) [39.375,60.5) [60.5,79.625) [79.625,99.5] -#> 18 21 19 19 23 +} if (have_units) { classIntervals(x_units, n=5, style="fisher") } @@ -588,155 +537,27 @@

Examples

} #> style: box #> one of 71,523,144 possible partitions of this [km/h] variable into 6 classes -#> [-46.375,4) [4,26.9375) [26.9375,52) [52,75.8125) [75.8125,100) -#> 0 25 25 25 25 -#> [100,149.125] -#> 0 -# \dontrun{ +#> [-Inf,-46.375) [-46.375,26.9375) [26.9375,52) [52,75.8125) +#> 0 25 25 25 +#> [75.8125,149.125) [149.125,Inf] +#> 25 0 +if (FALSE) { st <- Sys.time() x_POSIXt <- sample(st+((0:500)*3600), 100) fx <- st+((0:5)*3600)*100 classIntervals(x_POSIXt, style="fixed", fixedBreaks=fx) -#> style: fixed -#> one of 3,764,376 possible partitions of this variable into 5 classes -#> [2022-09-23 10:44:52.686004,2022-09-27 14:44:52.686004) -#> 21 -#> [2022-09-27 14:44:52.686004,2022-10-01 18:44:52.686004) -#> 18 -#> [2022-10-01 18:44:52.686004,2022-10-05 22:44:52.686004) -#> 19 -#> [2022-10-05 22:44:52.686004,2022-10-10 02:44:52.686004) -#> 21 -#> [2022-10-10 02:44:52.686004,2022-10-14 06:44:52.686004] -#> 21 classIntervals(x_POSIXt, n=5, style="sd") -#> style: sd -#> one of 14,887,031,544 possible partitions of this variable into 8 classes -#> [2022-09-21 13:44:20.740213,2022-09-24 14:50:28.726661) -#> 5 -#> [2022-09-24 14:50:28.726661,2022-09-27 15:56:36.713108) -#> 16 -#> [2022-09-27 15:56:36.713108,2022-09-30 17:02:44.699556) -#> 17 -#> [2022-09-30 17:02:44.699556,2022-10-03 18:08:52.686004) -#> 12 -#> [2022-10-03 18:08:52.686004,2022-10-06 19:15:00.672451) -#> 14 -#> [2022-10-06 19:15:00.672451,2022-10-09 20:21:08.6588) -#> 14 -#> [2022-10-09 20:21:08.6588,2022-10-12 21:27:16.645347) -#> 16 -#> [2022-10-12 21:27:16.645347,2022-10-15 22:33:24.631794] -#> 6 classIntervals(x_POSIXt, n=5, style="pretty") -#> style: pretty -#> one of 3,764,376 possible partitions of this variable into 5 classes -#> [2022-09-18 13:20:00,2022-09-24 08:13:20) -#> 4 -#> [2022-09-24 08:13:20,2022-09-30 03:06:40) -#> 33 -#> [2022-09-30 03:06:40,2022-10-05 22:00:00) -#> 21 -#> [2022-10-05 22:00:00,2022-10-11 16:53:20) -#> 30 -#> [2022-10-11 16:53:20,2022-10-17 11:46:40] -#> 12 classIntervals(x_POSIXt, n=5, style="equal") -#> style: equal -#> one of 3,764,376 possible partitions of this variable into 5 classes -#> [2022-09-23 23:44:52.686004,2022-09-28 00:08:52.686004) -#> 23 -#> [2022-09-28 00:08:52.686004,2022-10-02 00:32:52.686004) -#> 16 -#> [2022-10-02 00:32:52.686004,2022-10-06 00:56:52.686004) -#> 19 -#> [2022-10-06 00:56:52.686004,2022-10-10 01:20:52.686004) -#> 20 -#> [2022-10-10 01:20:52.686004,2022-10-14 01:44:52.686004] -#> 22 classIntervals(x_POSIXt, n=5, style="quantile") -#> style: quantile -#> one of 3,764,376 possible partitions of this variable into 5 classes -#> [2022-09-23 23:44:52.686004,2022-09-27 10:32:52.686004) -#> 20 -#> [2022-09-27 10:32:52.686004,2022-10-02 03:44:52.686004) -#> 20 -#> [2022-10-02 03:44:52.686004,2022-10-06 03:08:52.686004) -#> 20 -#> [2022-10-06 03:08:52.686004,2022-10-10 05:20:52.686004) -#> 20 -#> [2022-10-10 05:20:52.686004,2022-10-14 01:44:52.686004] -#> 20 classIntervals(x_POSIXt, n=5, style="kmeans") -#> style: kmeans -#> one of 3,764,376 possible partitions of this variable into 5 classes -#> [2022-09-23 23:44:52.686004,2022-09-27 02:44:52.686004) -#> 19 -#> [2022-09-27 02:44:52.686004,2022-10-01 01:44:52.686004) -#> 19 -#> [2022-10-01 01:44:52.686004,2022-10-05 10:14:52.686004) -#> 17 -#> [2022-10-05 10:14:52.686004,2022-10-09 14:14:52.686004) -#> 23 -#> [2022-10-09 14:14:52.686004,2022-10-14 01:44:52.686004] -#> 22 classIntervals(x_POSIXt, n=5, style="fisher") -#> style: fisher -#> one of 3,764,376 possible partitions of this variable into 5 classes -#> [2022-09-23 23:44:52.686004,2022-09-27 02:44:52.686004) -#> 19 -#> [2022-09-27 02:44:52.686004,2022-10-01 01:44:52.686004) -#> 19 -#> [2022-10-01 01:44:52.686004,2022-10-05 10:14:52.686004) -#> 17 -#> [2022-10-05 10:14:52.686004,2022-10-09 14:14:52.686004) -#> 23 -#> [2022-10-09 14:14:52.686004,2022-10-14 01:44:52.686004] -#> 22 classIntervals(x_POSIXt, style="headtails") -#> style: headtails -#> one of 99 possible partitions of this variable into 2 classes -#> [2022-09-23 23:44:52.686004,2022-10-03 18:08:52.686004) -#> 50 -#> [2022-10-03 18:08:52.686004,2022-10-14 01:44:52.686004] -#> 50 classIntervals(x_POSIXt, style="maximum") -#> style: maximum -#> one of 14,887,031,544 possible partitions of this variable into 8 classes -#> [2022-09-23 23:44:52.686004,2022-09-30 08:44:52.686004) -#> 37 -#> [2022-09-30 08:44:52.686004,2022-10-01 01:44:52.686004) -#> 1 -#> [2022-10-01 01:44:52.686004,2022-10-01 18:14:52.686004) -#> 1 -#> [2022-10-01 18:14:52.686004,2022-10-04 02:44:52.686004) -#> 12 -#> [2022-10-04 02:44:52.686004,2022-10-07 09:44:52.686004) -#> 16 -#> [2022-10-07 09:44:52.686004,2022-10-09 14:14:52.686004) -#> 11 -#> [2022-10-09 14:14:52.686004,2022-10-12 22:14:52.686004) -#> 16 -#> [2022-10-12 22:14:52.686004,2022-10-14 01:44:52.686004] -#> 6 classIntervals(x_POSIXt, style="box") -#> style: box -#> one of 71,523,144 possible partitions of this variable into 6 classes -#> [2022-09-13 03:07:22.686004,2022-09-23 23:44:52) -#> 0 -#> [2022-09-23 23:44:52,2022-09-28 10:14:52.686004) -#> 25 -#> [2022-09-28 10:14:52.686004,2022-10-03 17:44:52.686004) -#> 25 -#> [2022-10-03 17:44:52.686004,2022-10-08 14:59:52.686004) -#> 25 -#> [2022-10-08 14:59:52.686004,2022-10-14 01:44:53) -#> 25 -#> [2022-10-14 01:44:53,2022-10-23 22:07:22.686004] -#> 0 -# } +} # see vignette for further details -# \dontrun{ +if (FALSE) { # Head Tails method is suitable for right-sided heavy-tailed distributions set.seed(1234) # Heavy tails----- @@ -758,7 +579,6 @@

Examples

plot(classIntervals(weibulldist, style = "headtails"), pal = pal1, main = "HeadTails: Weibull Dist.") - plot(classIntervals(paretodist, n = 5, style = "fisher"), pal = pal1, main = "Fisher: Pareto Dist.") @@ -768,7 +588,6 @@

Examples

plot(classIntervals(weibulldist, n= 4, style = "fisher"), pal = pal1, main = "Fisher: Weibull Dist.") - par(opar) @@ -806,9 +625,8 @@

Examples

pal = pal1, main = "Uniform Distribution thr = .6" ) - par(opar) -# } +}
@@ -823,7 +641,7 @@

Examples

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/classify_intervals.html b/docs/reference/classify_intervals.html index b3b5332..4863b12 100644 --- a/docs/reference/classify_intervals.html +++ b/docs/reference/classify_intervals.html @@ -17,7 +17,7 @@ classInt - 0.4-8 + 0.4-10 @@ -206,7 +206,7 @@

Examples

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/findColours-1.png b/docs/reference/findColours-1.png index ca1e5bb..b101c9e 100644 Binary files a/docs/reference/findColours-1.png and b/docs/reference/findColours-1.png differ diff --git a/docs/reference/findColours-2.png b/docs/reference/findColours-2.png index d0e2176..3782d3b 100644 Binary files a/docs/reference/findColours-2.png and b/docs/reference/findColours-2.png differ diff --git a/docs/reference/findColours.html b/docs/reference/findColours.html index 44871f1..385ef6e 100644 --- a/docs/reference/findColours.html +++ b/docs/reference/findColours.html @@ -17,7 +17,7 @@ classInt - 0.4-8 + 0.4-10 @@ -194,7 +194,7 @@

Examples

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/findCols.html b/docs/reference/findCols.html index e593f45..b872309 100644 --- a/docs/reference/findCols.html +++ b/docs/reference/findCols.html @@ -17,7 +17,7 @@ classInt - 0.4-8 + 0.4-10 @@ -166,7 +166,7 @@

Examples

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/getBclustClassIntervals-1.png b/docs/reference/getBclustClassIntervals-1.png index f304ae8..0fdf167 100644 Binary files a/docs/reference/getBclustClassIntervals-1.png and b/docs/reference/getBclustClassIntervals-1.png differ diff --git a/docs/reference/getBclustClassIntervals-2.png b/docs/reference/getBclustClassIntervals-2.png index 9a0521d..050bdbb 100644 Binary files a/docs/reference/getBclustClassIntervals-2.png and b/docs/reference/getBclustClassIntervals-2.png differ diff --git a/docs/reference/getBclustClassIntervals-3.png b/docs/reference/getBclustClassIntervals-3.png index 80e5e60..1faa213 100644 Binary files a/docs/reference/getBclustClassIntervals-3.png and b/docs/reference/getBclustClassIntervals-3.png differ diff --git a/docs/reference/getBclustClassIntervals.html b/docs/reference/getBclustClassIntervals.html index 8b5cce9..d73c329 100644 --- a/docs/reference/getBclustClassIntervals.html +++ b/docs/reference/getBclustClassIntervals.html @@ -17,7 +17,7 @@ classInt - 0.4-8 + 0.4-10 @@ -142,7 +142,7 @@

Examples

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/index.html b/docs/reference/index.html index abe106a..710dd89 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -17,7 +17,7 @@ classInt - 0.4-8 + 0.4-10 @@ -101,7 +101,7 @@

All functions
-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/jenks.tests.html b/docs/reference/jenks.tests.html index 5db53fb..9881098 100644 --- a/docs/reference/jenks.tests.html +++ b/docs/reference/jenks.tests.html @@ -17,7 +17,7 @@ classInt - 0.4-8 + 0.4-10 @@ -183,7 +183,7 @@

Examples

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/docs/reference/logLik.classIntervals.html b/docs/reference/logLik.classIntervals.html index 663b2d5..6996426 100644 --- a/docs/reference/logLik.classIntervals.html +++ b/docs/reference/logLik.classIntervals.html @@ -17,7 +17,7 @@ classInt - 0.4-8 + 0.4-10 @@ -156,7 +156,7 @@

Examples

-

Site built with pkgdown 2.0.6.

+

Site built with pkgdown 2.0.7.

diff --git a/inst/tinytest/test_largeN.R b/inst/tinytest/test_largeN.R new file mode 100644 index 0000000..0d531f6 --- /dev/null +++ b/inst/tinytest/test_largeN.R @@ -0,0 +1,8 @@ +library(classInt) +# issue 44 +set.seed(101) +large_n <- 1000 +x <- 1:(large_n + 1) +expect_warning(classInt::classIntervals(x, n = 10, style = "fisher", + largeN = large_n, samp_prop = 0.05)) + diff --git a/man/classIntervals.Rd b/man/classIntervals.Rd index 039c8e4..5e3f93b 100644 --- a/man/classIntervals.Rd +++ b/man/classIntervals.Rd @@ -30,7 +30,7 @@ classIntervals2shingle(x) \item{dataPrecision}{default NULL, permits rounding of the interval endpoints (added by Richard Dunlap). The data precision used for printing interval values in the legend returned by \code{findColours}, and in the \code{print} method for classIntervals objects. If intervalClosure is \dQuote{left}, the value returned is \code{ceiling} of the data value multiplied by 10 to the dataPrecision power, divided by 10 to the dataPrecision power. The argument does not round \code{var}, the input variable.} \item{warnSmallN}{default TRUE, if FALSE, quietens warning for n >= nobs} \item{warnLargeN}{default TRUE, if FALSE large data handling not used} - \item{largeN}{default 3000L, the QGIS sampling threshold; over 3000, the observations presented to "fisher" and "jenks" are either a \code{samp_prop=} sample or a sample of 3000, whichever is larger} + \item{largeN}{default 3000L, the QGIS sampling threshold; if \code{warnLargeN}is TRUE and the number of observations is greater than \code{largeN}, the observations presented to "fisher" and "jenks" are either a \code{samp_prop=} sample of the observations, or a sample of \code{largeN}, whichever is smaller} \item{samp_prop}{default 0.1, QGIS 10\% sampling proportion} \item{gr}{default \code{c("[", "]")}, if the \pkg{units} package is available, \code{units::units_options("group")} may be used directly to give the enclosing bracket style} \item{\dots}{arguments to be passed to the functions called in each style}