rroxygen2

Is a package's help index page customizable?


The help() function allows us to see an index with a list of all functions within a package:

help(package=stats)

If the package is very large, the help page will be automatically broken down alphabetically, with links to each section by initial letter (as in the case of stats). Smaller packages will have all the functions together in alphabetical order.

Is this index page customizable?

I'm using roxygen2, and would love to be able to group functions by their @family.


Solution

  • See section 10.6 of R Packages :

    You can use roxygen to provide a help page for your package as a whole.

    you need to document NULL, and then manually label it with @docType package and @name . This is also an excellent place to use the @section tag to divide up page into useful categories.

    Just create an mypackage.R file with the above Roxygen tags applied to NULL:

    #' Mypackage: A package I created
    #'
    #' MyPackage has different families of functions described below
    #' 
    #' @section Some functions:
    #' * [mysum()] 
    #' * [myprod()]
    #' 
    #' @section Other functions:
    #' * [other()]
    #' * [foo()]
    #'
    #' @docType package
    #' @name mypackage
    NULL
    

    The brackets [] allow to create links to the functions of the package.