17

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.

lmo
  • 37,904
  • 9
  • 56
  • 69
Servadac
  • 170
  • 8
  • Does it work after building? – Axeman Sep 02 '16 at 13:05
  • 1
    If I generate the documentation, build the .tar file, install it and library the package there's still the same problem. I usually close and reopen RStudio to make things work. However, this is a really tedious task to just preview the .Rd files. – Servadac Sep 02 '16 at 15:45
  • @Servadac Do you still have this issue? – Dason Apr 17 '17 at 18:28
  • The solution I've found is Built & Reload the package , with the RStudio button, what needs more time and is not as useful to debug the code. When I write this question I didn't know that RStudio has this capability. – Servadac Apr 18 '17 at 19:25

1 Answers1

4

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)
petermeissner
  • 12,234
  • 5
  • 63
  • 63