Search code examples
rroxygen2

Having trouble making F1 help page


I'm following along with the roxygen2 documentation, and trying to make packages. I ran the example they provided, but with the addition of making it exportable.

#' Add together two numbers
#'
#' @param x A number.
#' @param y A number.
#' @return A number.
#' @export
#' @examples
#' add(1, 1)
#' add(10, 1)
add <- function(x, y) {
  x + y
}

After running roxygenise() and devtools::load_all(), I can see "add" showing up as a function of "project". Starting to type project::add() will bring up the hovering menu with some information, including the message about pressing F1 for more information. However, pressing F1 gives the following message:

No documentation for ‘add’ in specified packages and libraries:
you could try ‘??add’

What else do I need to do to set up the help page? I want to make sure that people can see the example portions of the packages I write.

I should add that I can call up the page with ?add, however my question is about the F1 call specifically.


Solution

  • The devtools::load_all() tries to be very fast while still emulating enough functionality that you can test your package. Some things require a full install and then package load.

    Try to install the package with devtools::install(), restart your R session and then use library(my_package). Then F1 should work.