masking

Thomas Lumley tlumley@u.washington.edu
Tue, 28 May 2002 17:27:03 -0700 (PDT)


On Tue, 28 May 2002, Clayton Springer wrote:
>
> % less  zzz.R
> .First.lib <- function(lib, pkg) library.dynam("dI", pkg, lib)
>
> is.Surv <- function(x) inherits(x, "Surv")
>
> tree.depth <- function (nodes)
> {
>     depth <- floor(log(nodes, base = 2) + 1e-7)
>     as.vector(depth - min(depth))
> }
>
> string.bounding.box <- function(s)
> {
>     s2 <- strsplit(s, "\n")
>     rows <- sapply(s2, length)
>     columns <- sapply(s2, function(x) max(nchar(x)))
>     list(columns=columns, rows=rows)
> }
>
>
> My question:
>
> 1.  Why is the functionality of the 'zzz.R' file needed?

To provide functions that aren't in base R but are needed by rpart. For
example, is.Surv is only in the survival package.

> 2.  How do I retain it without creating conflicts with rpart proper?

You could require rpart to be loaded, in which case your package wouldn't
need to contain these functions. (add require("rpart") to the .First.lib
function)

It may be that you don't need these functions, in which case you can just
remove them

Otherwise you're stuck -- you need the functions in your package and rpart
needs them, so you will get the warning when both are loaded together.
This is fairly harmless.

	-thomas

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._