Skip to content

Alias collision when documenting package which contains a function with the same name. #1160

Closed
@brendanf

Description

@brendanf

There seems to have been a reversion sometime since this Stack Exchange answer was given; now when I make a new package hello using

hello/R/hello.R:

#' hello
#'
#' This is a mostly empty package to learn roxygen documentation.
#'
#' Hello allows me to learn how to write documentation in comment blocks
#' co-located with code.
"_PACKAGE"

#' hello
#'
#' This function returns "Hello, world!".
#' @export
#' @examples
#' hello()

hello <- function() {
  print("Hello, world!")
}

and hello/DESCRIPTION:

Package: hello
Type: Package
Title: A mostly empty package
Version: 0.1
Date: 2016-06-21
Authors@R: person("Some", "Person", email = "[email protected]", role = c("aut", "cre"))
Description: More about what it does (maybe more than one line)
License: MIT
LazyData: TRUE
RoxygenNote: 7.1.0

and then build documentation, I get the following hello/man/hello-package.Rd:

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hello.R
\docType{package}
\name{hello-package}
\alias{hello}
\alias{hello-package}
\title{hello}
\description{
This is a mostly empty package to learn roxygen documentation.
}
\details{
Hello allows me to learn how to write documentation in comment blocks
co-located with code.
}
\author{
\strong{Maintainer}: Some Person \email{[email protected]}

}

The \alias{hello} line conflicts with documentation for hello(), resulting in the R CMD check warning Rd files with duplicated alias 'hello': ‘hello-package.Rd’ ‘hello.Rd’

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviorrd ✍️

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions