[Rd] problems with new checks in R-devel

Kurt Hornik Kurt.Hornik@ci.tuwien.ac.at
Sat, 29 Sep 2001 09:56:34 +0200


>>>>> Paul Gilbert writes:

> Below are a few problems I have encountered with the new checks
> being done in R-devel.

> 2/ I have some generics which may or may not already be defined
> (e.g. lag would be defined if library ts is attached) so in my R
> code I use

> if (!exists("lag")) lag <- function(x, ...) { UseMethod("lag") }

> but this results in

> Objects with usage in file `.../tframe/man/lag.tframe.Rd' but
> missing from code:
> [1] "lag"

> Is there a better way to approach this in my R code so I don't
> get these warnings?

Use library(ts) in the package's .First.lib instead.

Or help improving the logic in checkMethods(): currently we only eval
top-level *assignments* in the R code.  Otherwise, we have problems with
code used for creating save images calling e.g. dyn.load.

> 3/  I have a few general introduction  .Rd files which do not
> have a usage line and they produce

> * checking for undocumented arguments in \usage ... WARNING
> Error in parse(file, n, text, prompt) : parse error
> Error in checkDocArgs(dir = ".../syskern") :
>         cannot source usages in file
> .../syskern/man/00Intro.syskern.Rd
> Execution halted

> Should that be expected or is it a bug?

The version of dse I have access to in fact has

  \usage{library("syskern")}

Using the current logic, extract-usage thinks this documents the usage
of function library(), and hence translates to

  library <- function("syskern")

which gives the syntax error.  Using library(syskern) will work but give
a warning about the undocumented argument `syskern'.

In an ideal world we would not have to rely on heuristics but have

  <usage> <s-code>...</s-code> </usage>

alas we do not have that yet.  [More precisely: we would also know what
kind of topic was documented, and exclude documentation for packages
from the function checking.]

With the advent of the new documentation engine nowhere in sight, maybe
we should have a markup like

  \IAmNotSCode{...}

for taking care of the above.

-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._