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

Add use_package_doc() details for package and function by the same name #1898

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 18 additions & 6 deletions R/documentation.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
#' Package-level documentation
#'
#' Adds a dummy `.R` file that will prompt roxygen to generate basic
#' Adds a dummy `.R` file that will cause roxygen2 to generate basic
#' package-level documentation. If your package is named "foo", this will make
#' help available to the user via `?foo` or `package?foo`. Once you call
#' `devtools::document()`, roxygen will flesh out the `.Rd` file using data from
#' the `DESCRIPTION`. That ensures you don't need to repeat the same information
#' in multiple places. This `.R` file is also a good place for roxygen
#' directives that apply to the whole package (vs. a specific function), such as
#' global namespace tags like `@importFrom`.
#' `devtools::document()`, roxygen2 will flesh out the `.Rd` file using data
#' from the `DESCRIPTION`. That ensures you don't need to repeat (and remember
#' to update!) the same information in multiple places. This `.R` file is also a
#' good place for roxygen directives that apply to the whole package (vs. a
#' specific function), such as global namespace tags like `@importFrom`.
#'
#' There is one tricky case: when a **package** named "foo" also has a
#' **function** named `foo()`. In this case, after running `use_package_doc()`,
#' there will be an `R CMD check` warning. The solution is to set the `@aliases`
#' for the package-level help topic by modifying the dummy `.R` file (e.g.,
#' `foo-package.R`) as shown below (but substitute the name of your package /
#' function for "foo"):
#'
#' ```
#' #' @keywords internal
#' #' @aliases foo-package
#' #' "_PACKAGE"
#' ```
#' @seealso The [documentation chapter](https://r-pkgs.org/man.html) of [R
#' Packages](https://r-pkgs.org)
#' @inheritParams use_template
Expand Down
25 changes: 19 additions & 6 deletions man/use_package_doc.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading