Skip to content

Commit 58cecfc

Browse files
committed
older edits
1 parent 7949100 commit 58cecfc

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: classInt
2-
Version: 0.4-9
3-
Date: 2023-02-21
2+
Version: 0.4-10
3+
Date: 2023-08-15
44
Title: Choose Univariate Class Intervals
55
Authors@R: c(
66
person("Roger", "Bivand", role=c("aut", "cre"), email="[email protected]", comment=c(ORCID="0000-0003-2392-6140")),

R/classInt.R

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,17 @@ classIntervals <- function(var, n, style="quantile", rtimes=3, ..., intervalClos
168168
svar <- scale(var)
169169
pars <- c(attr(svar, "scaled:center"), attr(svar, "scaled:scale"))
170170
names(pars) <- c("center", "scale")
171-
sbrks <- pretty(x=svar, n=n, ...)
171+
dots <- list(...)
172+
if (is.null(dots$sd_m)) {
173+
sbrks <- pretty(x=svar, n=n, ...)
174+
} else {
175+
sbrks <- dots$sd_m
176+
stopifnot(is.numeric(sbrks))
177+
}
172178
brks <- c((sbrks * pars[2]) + pars[1])
179+
if (!is.finite(brks[1])) brks[1] <- min(var)
180+
if (!is.finite(brks[length(brks)])) brks[length(brks)] <- max(var)
181+
if (any(order(brks) != 1:length(brks))) brks <- unique(sort(brks))
173182
} else if (style =="equal") {
174183
brks <- seq(min(var), max(var), length.out=(n+1))
175184
} else if (style =="pretty") {

man/classIntervals.Rd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ classIntervals2shingle(x)
4747
\details{
4848
The "fixed" style permits a "classIntervals" object to be specified with given breaks, set in the \code{fixedBreaks} argument; the length of \code{fixedBreaks} should be n+1; this style can be used to insert rounded break values.
4949

50-
The "sd" style chooses breaks based on \code{pretty} of the centred and scaled variables, and may have a number of classes different from n; the returned \code{par=} includes the centre and scale values.
50+
The "sd" style chooses breaks based on \code{pretty} of the centred and scaled variables, and may have a number of classes different from n; the returned \code{par=} includes the centre and scale values. If argument \code{sd_m} is given as a numeric vector of multiples to apply to the standard deviation such as \code{c(-Inf, -2, -1, 0, 1, 2, +Inf)}
5151

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

0 commit comments

Comments
 (0)