From rkoenker at uiuc.edu  Fri Feb 20 22:15:57 2015
From: rkoenker at uiuc.edu (RKoenker)
Date: Fri, 20 Feb 2015 13:15:57 -0800 (PST)
Subject: [Rd] requireNamespace etiquette
Message-ID: <1424466957867-4703620.post@n4.nabble.com>

I'm trying to resolve a problem of Namespaces and probably have misunderstood
something basic.
In my quantreg package the function crq() has as its first argument a
formula that typically contains
something like this: Surv(y, ...) ~ foo,  where Surv is a function from the
survival package which
quantreg suggests.  When this syntax is encountered in ordinary usage Surv
is resolved, I believe,
because near the beginning of the crq code there is the locution:

if(!requireNamespace("survival", quietly = TRUE))
        stop("crq requires survival package to be installed")

However, when R CMD check tries to do one of the crq examples I see:

> f <- crq(Surv(y,d,type = "left") ~ x, method = "Portnoy")
Error in eval(expr, envir, enclos) : could not find function "Surv"
Calls: crq ... eval -> model.frame -> model.frame.default -> eval -> eval
Execution halted

Can someone suggest a fix?

Roger






--
View this message in context: http://r.789695.n4.nabble.com/requireNamespace-etiquette-tp4703620.html
Sent from the R devel mailing list archive at Nabble.com.



[Rd] requireNamespace etiquette
RKoenker