Export R package documentation to a web page

I created the R package after Hadley Wickham's instructions on how to create and document packages with Roxygen . Now I would like to export the help pages and vignettes to a bunch of html files so that they can be read and linked on the website.

When I look through my library for the installed package, there is an html folder, but it contains only the 00Index.html page. Is there an easy way to export the rest (help pages and vignettes) of my package documentation?

+5
source share
2 answers

You can use the Hadley Wickham package to develop (rather than CRAN) staticdocs .

Alternatively, if you have processed Rd files, you can convert them to HTML using the Rd2HTML utility from the tools package that comes with R. Read more about this with ?tools::Rd2HTML

+4
source

Minor modification The function of Yihui Xie to create static HTML help pages for R packages , so that it creates static pages in the html directory of the package.

 static_help = function(pkg, links = tools::findHTMLlinks()) { wd <- getwd() helpdir <- system.file('html', package = "tradeflows") setwd(helpdir) message("Generated help files will be placed in ", helpdir) pkgRdDB = tools:::fetchRdDB(file.path(find.package(pkg), 'help', pkg)) force(links); topics = names(pkgRdDB) for (p in topics) { tools::Rd2HTML(pkgRdDB[[p]], paste(p, 'html', sep = '.'), package = pkg, Links = links, no_links = is.null(links)) } setwd(wd) # Get back to the current working directory } 

To use it for your package in development:

 static_help("my_package_name") 

You will need to re-run this function every time you create a package.

+2
source

All Articles