Skip to content

Commit c8da382

Browse files
StephenMilborrowcran-robot
authored andcommitted
version 2.1.2
1 parent 4c288db commit c8da382

17 files changed

Lines changed: 101 additions & 61 deletions

DESCRIPTION

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Package: rpart.plot
2-
Version: 2.1.1
2+
Version: 2.1.2
33
Title: Plot 'rpart' Models: An Enhanced Version of 'plot.rpart'
44
Author: Stephen Milborrow
55
Maintainer: Stephen Milborrow <milbo@sonic.net>
6-
Depends: rpart (>= 4.1-0)
7-
Suggests: earth
6+
Depends: R (>= 3.2.0), rpart (>= 4.1-10)
7+
Suggests: earth (>= 4.4.6)
88
Description: Plot 'rpart' models. Extends plot.rpart() and text.rpart()
99
in the 'rpart' package.
1010
License: GPL-3
1111
URL: http://www.milbo.org/rpart-plot
1212
NeedsCompilation: no
13-
Packaged: 2017-02-17 15:20:10 UTC; milbo
13+
Packaged: 2017-04-20 22:36:55 UTC; milbo
1414
Repository: CRAN
15-
Date/Publication: 2017-02-17 18:31:24
15+
Date/Publication: 2017-04-20 23:40:18 UTC

MD5

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,41 @@
1-
8d369c3ff69adfd563dc594af022bd49 *DESCRIPTION
1+
27d4ddc062c8193e09fea416316c3e69 *DESCRIPTION
22
c99494dff84eec63d342c44560fa9e39 *NAMESPACE
3-
15d05d627dac0890088016e623d98f92 *NEWS
4-
d33619923af44f1a2e1851daabeb0cfb *R/as.char.R
3+
3d1a8d45ffdfee8ff16cc827512a5ec4 *NEWS
4+
d8c74f0400a25d5a9878bd0f76804206 *R/as.char.R
55
e11d9eb01bb29b3f4b4d82352318a908 *R/branches.R
66
159a5de6b74488f9535e537cd8599146 *R/check.index.R
77
56c503b1e1c82e42d089bdb8c6832780 *R/describe.col.R
88
8ab30c29dc47f1abf91054f416bc2ac4 *R/layout.R
9-
e063830bf28d5df5fd2f1cbd932dc401 *R/lib.R
10-
f4fc2950c7e2d0ce70e017039b1fe085 *R/lib.rpart.plot.R
11-
f5ef839728b3535b1cc7d42181bc7f14 *R/mvpart.labs.R
9+
321e8917a170396a96da2cc133eb4ef7 *R/lib.R
10+
529b7c8a2fe375a01bfcea3504b142d9 *R/lib.rpart.plot.R
11+
9c6c2bf8e34df1efdd611480403f365b *R/mvpart.labs.R
1212
b866faed54ca6a5552cc6df86c7f6903 *R/my.rpartco.R
1313
4a3221811be63dbc457a5a4125d903b6 *R/my.snip.rpart.R
14-
4498cd52475838993c5739eb7ea1544c *R/node.labs.R
14+
db634907bf111764df3cec88fe2d2ea6 *R/node.labs.R
1515
c2c473c7a564e7bc53b257adb44e6caf *R/node.numbers.R
1616
3e4decdeaf5f6113bc42cc968e76ae51 *R/palette.R
17-
43254a81fc89ec5e1488cf21cafd087d *R/prp.R
17+
de1229e282c6d8b5c0824fd76b99d45a *R/prp.R
1818
f53926a88bd6c9b2c61217dbed9411cd *R/rounded.rect.R
1919
5edc330cf0e2e794782eae4f1049519c *R/show.prp.palettes.R
20-
a7e1ccdfc7cf641f39f61b574db6ae5a *R/snip.R
21-
642e1a27a9409902b45f91473520cf5e *R/split.labs.R
20+
324f28ee3f9453c1bf089ecbfb4bf836 *R/snip.R
21+
dbc77bee7f4e6657f7c057433bc5ffd8 *R/split.labs.R
2222
61b42c5bb8a7979fdf47096e907b2467 *R/yes.no.R
2323
f66787088c53930a51438504efeca4bf *data/ptitanic.rda
2424
1fd39a5751f9ab8448fe4717a11e1359 *inst/doc/index.html
2525
54b2de7b5952d888851e2a8c898bd0e9 *inst/doc/prp.pdf
2626
3c62240e2713b9df6c690f278b0dc377 *inst/slowtests/README.txt
27-
8485c8e16261d1d9d6d8e785dec4aa55 *inst/slowtests/code.in.rpart.report.with.prp.R
27+
6f02008dafca85a76f7eeed4a29133ed *inst/slowtests/code.in.rpart.report.with.prp.R
2828
147bd7a75b6159f73762a034b106c82a *inst/slowtests/data.stagec
29-
0a17ca651cb20a99fe23cd7d6fbf89f1 *inst/slowtests/make.bat
29+
2d47376588215b0ba69335125da7a2d7 *inst/slowtests/make.bat
3030
6f0d3c65c63fa4c85a4aee61d4194f4e *inst/slowtests/test.imports.R
3131
54b78ce23c8c40d8931ca3261e72cf32 *inst/slowtests/test.na.R
3232
30d5362044c55e9f709ecf4ace61d2bf *inst/slowtests/test.palette.R
33-
ad2d7167ecaaa6ec943e28716246e4d4 *inst/slowtests/test.prp.R
34-
542328177987dc66ae7b4abf81816119 *inst/slowtests/test.prp.Rout.save
33+
ac6ce6b422dbc2fb90724eae20aa7c8c *inst/slowtests/test.prp.R
34+
3f8f484f8475345bd8dc34235346f199 *inst/slowtests/test.prp.Rout.save
3535
bb12d9317f21638863e7228d3649ed46 *inst/slowtests/user-manual-figs.R
3636
7de7c67ccb877d39eeda4b0f957795de *inst/slowtests/webpage-figs.R
37-
79e7bd1186dd59f714838ce2bafd85d7 *man/prp.Rd
37+
15f59d83eafea5f30a183e66e81787d6 *man/prp.Rd
3838
22a65a0943ca5a7ea692ddfb250ec4cc *man/ptitanic.Rd
39-
cabd46cd32ca00db5cfe64378b42ae12 *man/rpart.plot.Rd
39+
0d907416a4da1e09f786352b87802abd *man/rpart.plot.Rd
4040
002de08e8f4608bacb97f1e48d166e36 *man/rpart.plot.version1.Rd
4141
fe6c1a5e00b127bcec8412907b6a1888 *man/show.prp.palettes.Rd

NEWS

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
Changes to rpart.plot
22
---------------------
33

4-
2.1.1 Feb 17, 2016
4+
2.1.2 Apr 20, 2017
5+
6+
Added dependency on R version 3.2.0 (necessary for use of anyNA).
7+
8+
The digits argument can now be negative, meaning use the standard
9+
R "format" function (with the absolute value of digits).
10+
11+
2.1.1 Feb 17, 2017
512

613
Added the BlGnYl palette.
714

R/as.char.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
as.char <- function(object, maxlen=20)
55
{
6-
stopifnot(is.numeric(maxlen), length(maxlen) == 1, maxlen > 0)
6+
check.integer.scalar(maxlen, min=1)
77

88
if(is.null(object))
99
"NULL"
@@ -98,7 +98,7 @@ environment.as.char <- function(env, maxlen=60) # compact description
9898
print_summary <- function(x, xname=trunc.deparse(substitute(x)),
9999
trace=2, msg="", prefix="", details=2)
100100
{
101-
stopifnot(is.numeric(trace))
101+
check.numeric.scalar(trace)
102102
if(trace < 2)
103103
return()
104104
if(is.null(x)) {

R/lib.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,9 +499,11 @@ is.specified <- function(object)
499499
try <-
500500
try(!is.null(object) && !anyNA(object) && !identical(object, 0) &&
501501
# following needed for e.g. col=c("red", 0) because 0 is converted to string
502-
!identical(object, "0") && !identical(object, "NA"), silent=TRUE)
502+
!identical(object, "0") && !identical(object, "NA"), silent=FALSE)
503503
if(is.try.err(try)) {
504504
# this occurs if object is say a closure and anyNA fails
505+
# anyNA was introduced in R 3.1.0
506+
printf("\n") # separate from any message printed by try() above
505507
stop0(deparse(substitute(object)), ": illegal value")
506508
}
507509
try

R/lib.rpart.plot.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ formate <- function(x, digits=2, smallest=.001, largest=9999, strip.leading.zero
157157
formate1(x)
158158
}
159159
# formate starts here
160+
digits <- abs(digits) # TODO correct?
160161
stopifnot(is.numeric(digits) && length(digits) == 1 && digits > 0)
161162
stopifnot(is.numeric(x) && length(x) >= 1)
162163
stopifnot(is.numeric(smallest) && length(smallest) == 1 && smallest <= .1)
@@ -184,12 +185,12 @@ formate <- function(x, digits=2, smallest=.001, largest=9999, strip.leading.zero
184185

185186
format0 <- function(x, digits=2)
186187
{
187-
stopifnot(is.numeric(digits) && length(digits) == 1)
188+
check.integer.scalar(digits)
188189
if(digits == 0)
189190
digits <- getOption("digits")
190191
if(digits >= 0)
191192
formate(x, digits, smallest=.001, largest=9999)
192-
else # digits < 0 TODO not documented on prp man page
193+
else # digits < 0
193194
sapply(x, format, digits=-digits)
194195
}
195196
# formatf converts the given number (could also be a vector of

R/mvpart.labs.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ get.mvpart.labs <- function(x, extra, under, digits, xsep, varlen)
7171
"\n") # 11
7272

7373
labs <- sprintf("%s%s%s%%", labs, sep,
74-
formatf(100 * frame$wt / frame$wt[1], digits=max(0, digits-2)))
74+
formatf(100 * frame$wt / frame$wt[1],
75+
digits=max(0, abs(digits)-2)))
7576
}
7677
labs
7778
}

R/node.labs.R

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ internal.node.labs <- function(x, node.fun, node.fun.name, type, extra,
5252
labs <- x$functions$text(
5353
yval=if(is.null(frame$yval2)) frame$yval else frame$yval2,
5454
dev=frame$dev, wt=frame$wt, ylevel=attr(x, "ylevels"),
55-
digits=digits, n=frame$n, use.n=extra)
55+
digits=abs(digits), n=frame$n, use.n=extra)
5656
check.returned.labs(x, labs, "x$functions$text()")
5757
if(under)
5858
labs <- sub("\n", "\n\n", labs) # replace \n with \n\n
@@ -63,7 +63,7 @@ internal.node.labs <- function(x, node.fun, node.fun.name, type, extra,
6363
# call user's node.fun
6464
node.fun <- check.func.args(node.fun, "node.fun",
6565
function(x, labs, digits, varlen) NA)
66-
labs <- node.fun(x, labs, digits, varlen)
66+
labs <- node.fun(x, labs, abs(digits), varlen)
6767
check.returned.labs(x, labs, node.fun.name)
6868
}
6969
labs <- paste0(prefix, labs, suffix)
@@ -88,7 +88,8 @@ get.anova.labs <- function(x, extra, under, digits, xsep, varlen)
8888
if(extra >= 100) { # add percent?
8989
sep <- if(extra == 100) newline else " "
9090
labs <- sprintf("%s%s%s%%", labs, sep,
91-
formatf(100 * frame$wt / frame$wt[1], digits=max(0, digits-2)))
91+
formatf(100 * frame$wt / frame$wt[1],
92+
digits=max(0, abs(digits)-2)))
9293
}
9394
labs
9495
}
@@ -156,7 +157,7 @@ get.class.labs <- function(obj, extra, under, digits, xsep, varlen, class.stats)
156157
n.per.lev <- format0(class.stats$n.per.lev, digits)
157158
n.per.lev <- apply(matrix(n.per.lev, ncol=class.stats$nlev),
158159
1, paste.with.breaks, collapse=xsep)
159-
prob.per.lev <- formatf(class.stats$prob.per.lev, digits,
160+
prob.per.lev <- formatf(class.stats$prob.per.lev, abs(digits),
160161
strip.leading.zeros=print.all.probs)
161162
if(print.all.probs)
162163
prob.per.lev <- apply(matrix(prob.per.lev, ncol=class.stats$nlev),
@@ -200,7 +201,8 @@ get.class.labs <- function(obj, extra, under, digits, xsep, varlen, class.stats)
200201
"\n") # 9
201202

202203
labs <- sprintf("%s%s%s%%", labs, sep,
203-
formatf(100 * frame$wt / frame$wt[1], digits=max(0, digits-2)))
204+
formatf(100 * frame$wt / frame$wt[1],
205+
digits=max(0, abs(digits)-2)))
204206
}
205207
labs
206208
}
@@ -219,14 +221,15 @@ get.poisson.labs <- function(obj, extra, under, digits, xsep, varlen)
219221
labs <- sprintf("%s%s%s%s%s",
220222
rate, newline, nbr, xsep, format0(frame$n, digits))
221223
} else if(ex == 2) { # add number of events?
222-
labs <- sprintf("%s%s%s", rate, newline, nbr, digits)
224+
labs <- sprintf("%s%s%s", rate, newline, nbr)
223225
newline <- " " # want percent, if any, on same line
224226
} else
225227
stop0("extra=", extra, " is illegal (for method=\"", obj$method, "\")")
226228

227229
if(extra >= 100) # add percent?
228230
labs <- sprintf("%s%s%s%%", labs, newline,
229-
formatf(100 * frame$wt / frame$wt[1], digits=max(0, digits-2)))
231+
formatf(100 * frame$wt / frame$wt[1],
232+
digits=max(0, abs(digits)-2)))
230233
labs
231234
}
232235
print.node.labs.and.stop <- function(labs, fun.name, ...)

R/prp.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ prp <- function(x=stop("no 'x' arg"),
412412
if(length(family) != 1 || length(split.family) != 1 || length(nn.family) != 1)
413413
stop0("prp: family argument must be length 1 (family cannot be vectorized)")
414414
stopifnot(is.numeric(digits) && length(digits) == 1 &&
415-
floor(digits) == digits && digits >= 0)
415+
floor(digits) == digits) #$$$ && digits >= 0)
416416
if(digits == 0)
417417
digits <- getOption("digits")
418418
if(!is.na.or.zero(branch.type)) {

R/snip.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ do.snip <- function(obj, nodes, split.labels, node.xy, branch.xy,
8383
flush.console()
8484
}
8585
#--- do.mouse.snip starts here ---
86-
old.options <- options(width=1000, digits=digits) # so no wrap in print.node.info
86+
old.options <- options(width=1000, digits=abs(digits)) # so no wrap in print.node.info
8787
on.exit(options(width=old.options$width, digits=old.options$digits))
8888
cat("Click to snip ...\n")
8989
if(!is.null(snip.fun))

0 commit comments

Comments
 (0)