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

@name only matches the file name, not the Rd \name{} entry depending on collation order #1665

Open
MichaelChirico opened this issue Oct 13, 2024 · 0 comments

Comments

@MichaelChirico
Copy link
Contributor

Consider R/foo.R:

#' @rdname foo
#' @export
bar <- function(x) x

#' @rdname foo
#' @export
foo <- function(x) x

#' A foo
#' @param x An x
#' @name foo
NULL

Crucially, we are documenting foo() and bar() together, in a doc object whose contents (at least partially) come after the functions themselves.

I expected roxygenize() here to create man/foo.Rd with \name{foo}, however we get \name{bar}:

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/aaa.R
\name{bar}
\alias{bar}
\alias{foo}
\title{A foo}
\usage{
bar(x)

foo(x)
}
\arguments{
\item{x}{An x}
}
\description{
A foo
}

Context: I am trying to convert the custom doc mark-up {bit64} has been using to {roxygen2}.

as.factor.integer64 is documented in the object as.character.integer64, however, that actual definition comes in a (collation-wise) earlier R file:

https://github.com/r-lib/bit64/blob/691033911dc6a00bcaf70c7a38ba7c2a4aad6dcb/R/highlevel64.R#L2483
https://github.com/r-lib/bit64/blob/691033911dc6a00bcaf70c7a38ba7c2a4aad6dcb/R/integer64.R#L949-L959
https://github.com/r-lib/bit64/blob/691033911dc6a00bcaf70c7a38ba7c2a4aad6dcb/R/integer64.R#L2055

Thus my attempted migration fails, with the resulting \name{} having changed. I'd at least like a workaround. One possibility is copying the as.factor.integer64() definition into the 2nd file, but it makes navigating git history/blame harder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant