Thank you, Duncan, that fixed it! -----Original Message----- From: Duncan Murdoch <murdoch.dun...@gmail.com> Sent: Thursday, November 7, 2019 10:27 AM To: b...@denney.ws; r-package-devel@r-project.org Subject: Re: [R-pkg-devel] How to Document and S3 Method for the Parenthesis Class?
On 07/11/2019 9:35 a.m., b...@denney.ws wrote: > 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") I think this should work: \method{sha1}{`(`}(x, digits = 14, zapsmall = 7, ..., algo = "sha1") A quick test case gave me errors from not documenting the args, but not the bad \usage line error described below. Duncan Murdoch > > > > 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]] > > ______________________________________________ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel > ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel