R create reference manual with R CMD check
Asked Answered
B

4

43

I am writing an R package and would like to make a pdf reference manual of all functions in the package. I understood from here that R CMD check automatically creates a reference manual.

Here I read that a manual entry is created "of the functions you listed in the export section of NAMESPACE".

My NAMESPACE file looks as follows:

# Export all names
exportPattern(".")

# Import all packages listed as Imports or Depends
import(
  LIM
)

so I thought everything will be exported. During R CMD check on the package directory, at the very end it says:

 * checking PDF version of manual ... OK

However, I do not find a reference manual in my package directory (I would assume it would be in inst/doc). What am I missing here?

Blaeberry answered 7/6, 2013 at 14:22 Comment(0)
I
26

R CMD check creates a directory PACKAGE.RCheck. In this directory you could find the file PACKAGE-manual.pdf.

Injunction answered 7/6, 2013 at 15:30 Comment(1)
The PACKAGE-manual.pdf is located one folder above the package directory, in ../package.Rcheck.Oakes
H
86

Another way is to create the reference manual directly using:

R CMD Rd2pdf mypackage

where mypackage is the folder containing your R package code folder structure including the man folder with your .Rd files.

For some reason I never get the reference manual during build or check in RStudio, maybe because I've missed a setting somewhere. But running the command like this works fine as well.

Humidify answered 10/3, 2014 at 23:48 Comment(3)
Just tried it, it works well! Thanks for pointing out Rd2pdf!Blaeberry
Same problem as above, solved thanks to your suggestion. I really do not understand why Rstudio messes up so much.Silsby
While this is useful, it has a feature (?) that it does not respect .RbuildignoreChainman
I
26

R CMD check creates a directory PACKAGE.RCheck. In this directory you could find the file PACKAGE-manual.pdf.

Injunction answered 7/6, 2013 at 15:30 Comment(1)
The PACKAGE-manual.pdf is located one folder above the package directory, in ../package.Rcheck.Oakes
B
3

I had the same issue. It seems that when you click Build or Check in Rstudio (when using devtools), by default arguments of '--no-manual' are added to the R CMD options.

I solved this by manually giving the arguments in the R command prompt:

library(devtools)

check(cleanup = FALSE,manual = TRUE,path = getwd())

# without running the examples
check(cleanup = FALSE,args = c('--no-examples'),manual = TRUE,path = getwd())

In this case, a folder called package.Rcheck will contain the manual as package-manual.pdf

Also check for any errors in the output during the check. There might be characters that might crash the documentation.

Blastocyst answered 14/12, 2016 at 14:47 Comment(1)
see RStudio preferences to change this easilySurtout
F
2

Another workaround is to produce it with:

build_manual(path=getwd())
#or
check(manual = TRUE, args="--output=~/folder/subfolder")
Faraway answered 18/8, 2019 at 17:43 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.