I need to generate documentation for a collection of R programs. Unfortunately, building a package based on the source code is not an option (I know how to do that, and I have already experimented with RStudio, roxygen2, and packages, and it works like a charm). Can I use roxygen2 to to generate documentation from the R source code without building a package in a way similar to how doxygen works with C++? If not, are there other options for documenting R code that do not rely on packages?
Asked
Active
Viewed 1,845 times
1
-
I'm confused, if you're not using a package (and why not?), what will you do with the Rd files? – baptiste Jan 14 '15 at 17:26
-
@baptiste `R CMD Rd2pdf` will make a nice PDF from your Rd file... – Spacedman Jan 14 '15 at 17:31
-
The Rd files could be converted to HTML and saved to a directory, maybe with an index or table of contents. Doxygen for C++ works at the file level and does not require an additional structure (like in this case an R package). I had hoped that something similar might exist in R. The reason why I cannot build a package is that there is pre-existing code whose directory structure I am not supposed to change. – akinw Jan 14 '15 at 17:34
-
Voted down - can you be more clear? Is it something like having R functions in different folders rather than in a package structure? And you cant make a package because the code relies on the folder structure so much? Or something? Where are your functions, and what format do you want your documentation to be in? Do you want it accessible from `help(foo)` where `foo` is one of your functions? Please explain more and stop us guessing. – Spacedman Jan 14 '15 at 17:34
-
1OK, I was just asking for further context (which you c|should include in the question). If you look closely at `roxygen2::roxygenise`, you might find the relevant function that works at the file level (`roxygen2:::roc_process` seems a strong candidate). – baptiste Jan 14 '15 at 17:36
-
@Spacedman: The problem is that the R code is in various folders, and in each folder there are configuration files. Since I am extending an existing framework, I am not allowed to move any files. I know how to build a package. – akinw Jan 14 '15 at 17:44
1 Answers
0
If your only after the documentation, devtools::document()
will build the documentation files without building the package.

Jthorpe
- 9,756
- 2
- 49
- 64
-
that's calling `roxygen2::roxygenise` internally, and assumes a standard package directory structure – baptiste Jan 14 '15 at 17:34
-
Yes but `devtools::document` assumes that it works within a package structure. – Konrad Apr 12 '18 at 11:56