Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add class-specific alias without generic alias using Roxygen2?
    primarykey
    data
    text
    <p>A simple example is that I have created an extension to <code>show</code>, which is a S4 base method. I don't want to cause a disambiguation fork by re-documenting <code>show</code> in my package, and I also want to consolidate the documentation of my extension to <code>show</code> in the documentation for the new class, <code>myPkgSpClass</code>, by adding an alias for <code>show,myPkgSpClass-method</code>. </p> <pre><code>#' @export #' @aliases show,myPkgSpClass-method #' @rdname myPkgSpClass-class setMethod("show", "myPkgSpClass", function(object){ show(NA) }) </code></pre> <p>The problem I'm having, is that this results in an serious warning during documentation-build by roxygen2, <code>Rd files with duplicated alias 'show':</code> because there is more than one class extension to <code>show</code> in this package, and roxygen2 has automatically added the generic term in the list of aliases to all the relevant <code>*-class.Rd</code> files:</p> <pre><code>\alias{show} \alias{show,myPkgSpClass-method} </code></pre> <p>But I think I don't want the generic alias in any of the instances, because it will force the need for disambiguation between <code>show</code> in my package, and the base <code>show</code>. This issue also applies to other S4 methods extended from other packages besides <code>show</code>.</p> <p>If I tag all class-specific methods to the same <code>.Rd</code> file, then the warning goes away, but the ambiguity remains, because the <code>show</code> alias still gets added automatically for that doc entry. If I manually remove <code>\alias{show}</code> from the <code>.Rd</code> file, then the problem seems solved, no warnings during roxygen or <code>R CMD check pkgname</code>. So how do I get Roxygen2 to not-add the generic alias?</p> <p>Other background:</p> <p>This is a specific question building from a previous issue for exporting/documenting S4 extensions to base methods: <a href="https://stackoverflow.com/questions/8935523/is-it-necessary-to-export-base-method-extensions-in-an-r-package-documentation">Is it necessary to export base method extensions in an R package? Documentation implications?</a></p> <p>It is more specific than, and not covered by, the following questions regarding documenting S4 methods / classes using Roxygen2:</p> <p><a href="https://stackoverflow.com/questions/7356120/how-to-properly-document-s4-methods-using-roxygen2">How to properly document S4 methods using roxygen2</a></p> <p><a href="https://stackoverflow.com/questions/7368262/how-to-properly-document-s4-class-slots-using-roxygen2">How to properly document S4 class slots using Roxygen2?</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload