22

I would like to use a directory structure within the R folder for the source code of a package. For example, within my R folder I have an algos folder with functions I want to export and document. However roxygen2 by default does not seem to go through the subfolders of the R folder.

I tried to use the @include keyword as follows for a file at `R/algos/algo1.r'

#' @include algos/algo1.r

but without success. Is there a simple way to use subfolder for the R source code?

tlamadon
  • 890
  • 8
  • 17
  • 1
    Is there a particularly strong reason you want to go against the [required package structure](http://cran.r-project.org/doc/manuals/R-exts.html#Package-structure)? – Dason Feb 15 '13 at 19:59
  • 1
    no reason, it does not seem to say that one could not use subdirectories within the `R` folder, does it? – tlamadon Feb 15 '13 at 20:00

1 Answers1

29

Writing R Extensions has this to say (in Section 1.1.5) about subdirectories under the R directory:

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

Implied in this is that they can't have other subdirectories other than those two. This is confirmed in an r-devel thread and again later in another r-devel thread.

Brian Diggs
  • 55,682
  • 13
  • 158
  • 183
  • What is the reason for this limitation? – adam May 11 '19 at 12:27
  • @adam I don't think a reason has ever been given. I'm just guessing, but I imagine it was an implicit requirement based on how some aspect of the build tool was (is?) written. – Brian Diggs May 13 '19 at 22:10
  • 2
    that's a really weird limitation, how do i suppose to organize many dozens of functions/files? – simplyPTA Aug 09 '21 at 12:57