Servadac
Servadac

Reputation: 180

Preview development R documentation

I'm writing my first R Package using devtools and roxygen2 in the RStudio IDE. The problem I have is related with previewing the .Rd files I get when I "roxygenize" the .R files. I'm using devtools::document() in order to get the .Rd files, but when I try to preview the Help Pages by writing any of:

help("FunctionName")
?FunctionName

the console shows the message "Using development documentation for..." but there's a blank space in the help window. Using devtools:load_all() causes the same problem. Maybe this is related with the way devtools loads the package in the environment, but neither the document "Writing R Extensions" (that isn't expected to be consulted to use roxygen), nor the book "R packages" by Hadley Wickham provides a working solution.

Upvotes: 18

Views: 1508

Answers (1)

petermeissner
petermeissner

Reputation: 12861

In Rstudio under project options there is a generate documentation with roxygen item - check it.

enter image description here

Then click on Configure... and check the boxes like that:

enter image description here

Now, each time you hit Ctrl+Shift+B your doc files will be rebuild and you can browse them via clicking on the function name and hitting F1 or typing one of the following lines in the console:

?my_function
help(my_function)

Upvotes: 6

Related Questions