Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generating \alias{_PACKAGE} when adding @aliases {pkgname}-package to package documentation #1289

Closed
mbojan opened this issue Feb 18, 2022 · 3 comments

Comments

@mbojan
Copy link

mbojan commented Feb 18, 2022

Related to #1160.

In case a package pkgname includes a function pkgname() a strategy to avoid duplicated Rd alias pkgname is to "manually" add @aliases pkgname-package to R/pkgname-package.R. However, this also produces \alias{_PACKAGE} in the corresponding Rd file. For example this source file:

https://github.com/mbojan/roxypackagedoc/blob/0906e7f7d37147bdc3e906341a9530955a3f83d8/R/roxypackagedoc-package.R#L1-L9

#' Testing erroneous alias generation
#'
#' @aliases roxypackagedoc-package
#' @keywords internal
"_PACKAGE"

## usethis namespace: start
## usethis namespace: end
NULL

Produces (roxygen2 7.1.2) this Rd:

https://github.com/mbojan/roxypackagedoc/blob/0906e7f7d37147bdc3e906341a9530955a3f83d8/man/roxypackagedoc-package.Rd#L1-L11

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/roxypackagedoc-package.R
\docType{package}
\name{roxypackagedoc-package}
\alias{roxypackagedoc-package}
\alias{_PACKAGE}
\title{Testing erroneous alias generation}
\description{
Test for roxygen2 error when generating pkgname-package man page.
}
\keyword{internal}

c.f. dummy package https://github.com/mbojan/roxypackagedoc

@gaborcsardi gaborcsardi added the bug an unexpected problem or unintended behavior label Feb 18, 2022
@hadley
Copy link
Member

hadley commented Apr 6, 2022

In the mean time, you can work around this by doing #' @aliases roxypackagedoc-package NULL

@mbojan
Copy link
Author

mbojan commented Apr 6, 2022

OK! Thanks @hadley .

@hadley
Copy link
Member

hadley commented Jul 10, 2022

I think it's probably easiest to just document this pattern.

@hadley hadley added documentation and removed bug an unexpected problem or unintended behavior labels Jul 10, 2022
@hadley hadley added this to the 7.2.1 milestone Jul 10, 2022
@hadley hadley closed this as completed in b5bfe31 Jul 11, 2022
grantmcdermott added a commit to grantmcdermott/tinyplot that referenced this issue Apr 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants