简体   繁体   中英

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
Authors@R: person("Ben",
  "Me",
  email = "my@email.com",
  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...)?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM