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?
There are three main ways to run roxygen: roxygen2::roxygenise() . devtools::document() . Ctrl + Shift + D , if you're using RStudio.
Suppose if you want to create a subfolder under the current directory you can choose the paste command and can set the working directory. If you are using RStudio then press Ctrl + Shift + H and choose the desired directory.
To add documentation to an R package, you need to create a subdirectory “ man ” containing a set of files, one per function, in a special R Documentation format ( . Rd ). These will be the source for the documentation for each function; R processes them to create plain text, PDF, and HTML versions.
R packages are a collection of R functions, complied code and sample data. They are stored under a directory called "library" in the R environment. By default, R installs a set of packages during installation. More packages are added later, when they are needed for some specific purpose.
Writing R Extensions has this to say (in Section 1.1.5) about subdirectories under the R directory:
The
R
andman
subdirectories may contain OS-specific subdirectories namedunix
orwindows
.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With