[R-pkg-devel] Advice on elegant way to alias function name

Hadley Wickham h@w|ckh@m @end|ng |rom gm@||@com
Fri Sep 2 23:46:52 CEST 2022


On Fri, Sep 2, 2022 at 3:22 PM J C Nash <profjcnash using gmail.com> wrote:
>
> With some playing around I found a workable solution.
>
> - NAMESPACE needs  export(thefn)
> - thefn.Rd needs usage and arguments documented
> - myfn.Rd must NOT have alias(thefn)
>
> And I believe I've got the roxygen2 tags to work in Rstudio. In R itself,
> roxygen2 gives an error
>      Error: invalid version specification ‘0.68’
> though the string '0.68' appears nowhere in my package according to grep.
> I have no idea what this is about, especially as Rstudio works fine.
>
> While I like the idea of documentation in code files, I think I'll go
> back to separately created .Rd files.
>
> If anyone is interested, package and README are at
> https://gitlab.com/nashjc/nlsr2022

All you need is:

#' @export
#' @rdname wrapnlsr
nlsr <- wrapnlsr

That will document nlsr and nlsr together in the same file.

In general, if you find yourself having to use `@usage` or `@aliases`
to get R CMD check to pass cleanly, something is off with the way
you're documenting your functions.

Hadley

-- 
http://hadley.nz



More information about the R-package-devel mailing list