What is the proper way to document S4 methods in which the signature contains the `<-` class?

StackOverflow https://stackoverflow.com/questions/22293675

  •  12-06-2023
  •  | 
  •  

Question

In the Formula.tools package, I define and document the rhs method for expressions like A <- B.

#' @rdname formula.parts
#' @aliases rhs,set-method
setMethod( 'rhs', '<-', function(x) x[[3]] )

(n.b. the signature list '<-' is not wrong, here. It is actually the class of this assignment statement.)

For this S4 method, roxyger2-3.1.0, generates the following in the man/formula.parts.Rd:

\S4method{rhs}{<-}(x)

I believe the proper documentation tag should be:

\S4method{rhs}{`<-`}(x) 

Is there any way to force roxygen2 to generate the correct Rd syntax? I struggled with it a bit, but could not find a way.

Background

  • R-3.0.1
  • roxygen-3.1.0
Was it helpful?

Solution

I am answering my own questions, after reporting this as This an issue to the roxygen developers. This was confirmed to be not working prior to roxygen2-4.0.0. They pushed out a patch within a day. (Awesome!) Roxygen2 now produces the correct Rd syntax for signatures with <-.

Additional notes: Upgrading to roxygen2-4.0.0 requires R >= 3.0.2 and the newest version of Rcpp.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top