[R-pkg-devel] How to Document and S3 Method for the Parenthesis Class?

biii m@iii@g oii de@@ey@ws biii m@iii@g oii de@@ey@ws
Thu Nov 7 15:35:49 CET 2019


Hi,

 

Short version of the question:  How does one document a method for the "("
class in a .Rd file?

 

Details:

I recently contributed to the digest package functions to assist with
generating sha1 hashes for formula objects.  Sometimes within formula, the
parenthesis ("(") class is used, for example [1]:

 

> class((a~(b+c))[[3]])

[1] "("

 

So, I wrote a method to handle that class, too.  When trying to document it
in the .Rd file, I tried the following code, but when checking the
documentation, it gets an error:

 

\method{sha1}{"("}(x, digits = 14, zapsmall = 7, ..., algo = "sha1")

 

The error when checking the documentation is:

 

> checking Rd \usage sections ... WARNING

  Bad \usage lines found in documentation object 'sha1':

    <unescaped bksl>method{sha1}{"("}(x, digits = 14, zapsmall = 7, ...,
algo = "sha1")

  

  Functions with \usage entries need to have the appropriate \alias

  entries, and all their arguments documented.

  The \usage entries must correspond to syntactically valid R code.

  See chapter 'Writing R documentation files' in the 'Writing R

  Extensions' manual.

 

I have tried variants of escaping the parenthesis like "\(" and "\\(" and
the unescaped variant "(", too.

 

Thanks,

 

Bill

 

[1] In case the first thought is, "don't write formula which have a full
side within redundant parentheses", something equivalent to this was created
by update.formula().


	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list