[Roxygen-devel] setReplaceMethod problems
Manuel J. A. Eugster
Manuel.Eugster at stat.uni-muenchen.de
Thu Jul 22 20:23:38 CEST 2010
Thank you for the patch, Bart! It will be added to R-Forge soon,
and then will in the next CRAN release! Best, Manuel.
On 7/22/10 11:42 AM, Janssen, B.J. wrote:
> Hello,
>
> I am writing a package in R using S4 classes and had problems with
> roxygen when I tried to include a setReplaceMethod for one of my
> classes. Roxygen 0.1-2 revision 245 crashed whenever a
> setReplaceMethod declaration was encountered. Searching the net got
> me
> to<https://r-forge.r-project.org/tracker/index.php?func=detail&aid=842&group_id=183&atid=1500>
> which confirms it is not (yet) supported by roxygen.
>
> Installing the latest revision from svn (248) solved the crashing
> problem for me. It still produced a warning because
> "setReplaceMethod" was not recognized. This can be resolved by the
> patch included below. It just applies the same method as setMethod
> does to any setReplaceMethod encountered. The disadvantage is that it
> cannot handle duplicate naming. For example, it overwrites "[.Rd" if
> both a setMethod and a setReplaceMethod are declared for "[". These
> filenames should get renamed to something more sensible…
>
> Regards, Bart
>
>> svn diff Rd2.R
> Index: Rd2.R
> ===================================================================
> --- Rd2.R (revision 248) +++ Rd2.R (working copy) @@ -55,6 +55,14 @@
> formals=S4formals$definition) })
>
> +register.srcref.parser('setReplaceMethod', +
> function(pivot, expression) { + S4formals<-
> parseS4.method(cdr(expression)) +
> list(S4method=car(expression), +
> S4formals=S4formals, +
> formals=S4formals$definition) + }) + #' New
> implementation of the Rd roclet; same functionality as the original
> #' implementation plus basic S4 handling. #'
>
> _______________________________________________ Roxygen-devel mailing
> list Roxygen-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/roxygen-devel
More information about the Roxygen-devel
mailing list