Re: [S] title in post.tree & post.rpart

Atkinson, Beth (atkinson@mayo.edu)
Wed, 5 Aug 1998 09:43:02 -0500


----------
X-Sun-Data-Type: text
X-Sun-Data-Description: text
X-Sun-Data-Name: text
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 19

Looks like you found a bug in post.rpart. The corrected function
is included below.

~>
~> post.rpart(rpart.out, title="Humerus Data", file="pretty")
~>
~> Error in post.rpart(rpart.out, title = "..: Object "title."
~> not found
~> Dumped

- Beth

=====================================================================
Beth Atkinson (507) 284-0431
Mayo Clinic (507) 284-9542 FAX
200 First Street SW
Rochester, MN 55905 atkinson@mayo.edu
=====================================================================

----------
X-Sun-Data-Type: default
X-Sun-Data-Description: default
X-Sun-Data-Name: post.rpart.s
X-Sun-Charset: us-ascii
X-Sun-Content-Lines: 31

# SCCS 03/03/98 @(#)post.rpart.s 1.11
#
post.rpart <- function(tree, title,
filename=paste(deparse(substitute(tree)),".ps",sep=""),
digits= .Options$digits - 3, pretty=T,
use.n=T, horizontal=T, ...) {
if(filename !=""){
postscript(file = filename, horizontal=horizontal, ...)
par(mar=c(2,2,4,2)+.1)
on.exit(dev.off())
}
else {
oldpar <- par(mar=c(2,2,4,2)+.1)
on.exit(invisible(par(oldpar)))
}

plot(tree, uniform=T, branch=.2, compress=T, margin=.1)
text(tree, all=T, use.n=use.n, fancy=T, digits=digits, pretty=pretty)
method <- tree$method

# trickery to avoid warning message about "title" being both a variable
# and a function One frame down, the variable 'title' is not visible
tempfun <- function(x) title(x, cex=.8)

if(missing(title)) {
temp <- attr(tree$terms,'variables')[1]
tempfun(paste("Endpoint =",temp))
}
else if (title !="") tempfun(title)
}

-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu. To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message: unsubscribe s-news