[R-pkg-devel] Fwd: Please help with unexplainable check --as-cran warning for Rd file with \usage{\S4method{[[<-}{M1}(x, i, value)}

Georgi Boshnakov georgi.boshnakov at manchester.ac.uk
Sat Dec 24 11:20:14 CET 2016


Hi,

The usage line should look like this:

\S4method{[[}{M1}(x, i) <- value

Notice that the first argument of \S4method is '[[' not '[[<-' and the assignment is explicit.

-----------

The clue is that you get the error only for the replacement version. A little digging in R-exts.pdf unearths the 
Following:

       "An S4 replacement method is documented in the same way as an S3 one: see the description
       of \method in Section 2.1.1 [Documenting functions] ..."

Following the link we find:

    'Similarly, one can use \method{generic}{class}(arglist) <- value
      to indicate the usage of an S3 replacement method for the generic replacement 
     function "generic<-" for objects inheriting from class "class".'

Guessing that we need to replace '\method' with '\S4method' for S4 methods gives the answer given at the start of the email.


Kind regards,
Georgi Boshnakov





-----Original Message-----
From: R-package-devel [mailto:r-package-devel-bounces at r-project.org] On Behalf Of Markus Müller
Sent: 23 December 2016 16:32
To: r-package-devel at r-project.org
Subject: [R-pkg-devel] Fwd: Please help with unexplainable check --as-cran warning for Rd file with \usage{\S4method{[[<-}{M1}(x, i, value)}

Hi


I have build a small example package to reproduce the issue.
The usage lines with S4method work well for all other methods including overloaded operators (In my example package I  put [[ as an example)


The actual warning only occurs for the method overloading "[[<-"










** checking Rd \usage sections ... WARNINGBad \usage lines found in documentation object '[[<-,M1-method':  <unescaped
bksl>S4method{[[<-}{M1}(x,  i,  value)Functions with \usage entries need 
bksl>to
have the appropriate \aliasentries, and all their arguments documented.The \usage entries must correspond to syntactically valid R code.*

The example code for this operator works.

The funny thing is that when I comment the usage line in the Rd file the warning vanishes.
Although as a programmer I know that usually "the library isn't broken"
(but rather my code)  this almost seems like it ;-) At least I have no clue what to do to get a proper usage line.

the pkg.tar.bz2 contains the whole package directory before building.
The built package is OverloadedIndexedAssignment_0.1.tar.gz
along with the check dir and the log.

Cheers and Thanks in advance


More information about the R-package-devel mailing list