Recursively document R package

I’m trying to build my first package with RStudio.

I already had a project with R files and I just changed the project layout like this:

.
|-R
|---File
|---Physics
|---Plot
|---Utils
|-man
|-vignettes
|-DESCRIPTION
|-NAMESPACE

My DESCRIPTION file contains the following text:

Package: my-package
Title: Package title
Version: 0.0.0.9000
[email protected]: person("Ben",
  "Me",
  email = "[email protected]",
  role = c("aut", "cre"))
Description: blabla
Depends:
    R (>= 3.3.2)
License: file LICENSE
Encoding: UTF-8
LazyData: true
VignetteBuilder: knitr
Suggests:
    knitr,
    rmarkdown
RoxygenNote: 5.0.1

All my functions contain roxygen comments. And when I use the Build/Document function in RStudio, it says:

==> devtools::document(roclets=c('rd', 'collate', 'namespace', 'vignette'))

Updating my-package documentation
Loading my-package
Writing NAMESPACE
Updating vignettes
Documentation completed

But the man pages and the NAMESPACE file remain empty.

If I Build&Reload the project, I have a No man pages found in package message.

So I guess the Document command was not applied correctly. If I put an R script with comments directly at the root of the R folder, it finds it. Is there a way to make RStudio explore recursively all my code folders or should I just put all my files at the root of the R folder (which is cumbersome for someone coming from the Java world…)?

1

Answers


  1. Roman Luštrik
    0 Votes

    R documentation states that only the following folders are allowed (and have their own functions):

    The man subdirectory may contain a subdirectory named macros; this will contain source for user-defined Rd macros. (See User-defined macros.) These use the Rd format, but may not contain anything but macro definitions, comments and whitespace.

    The R and man subdirectories may contain OS-specific subdirectories named unix or windows.

Please signup or login to answer this question.

Signup for an account and start participating in our site today!




Social Signup

You can also login with your Facebook, Twitter or Linkedin account

Log in with Facebook