document (version 2.2.1)

document: Document (Chunks of) an R Code File

Description

Document (Chunks of) an R Code File

Usage

document(file_name, working_directory = NULL, output_directory = tempdir(),
  dependencies = NULL, sanitize_Rd = TRUE, runit = FALSE,
  check_package = TRUE, check_as_cran = check_package,
  stop_on_check_not_passing = TRUE, clean = FALSE, debug = TRUE, ...)

Arguments

file_name

The name of the R code file to be documented.

working_directory

A working directory. Keep the default.

output_directory

The directory to put the documentation into. You might want to use dirname(file_name).

dependencies

A character vector of package names the functions depend on.

sanitize_Rd

Remove strange characters from Rdconv?

runit

Convert the text received from the help files if running RUnit? Do not bother, this is for Unit testing only.

check_package

Run R CMD check the sources? See Note below.

check_as_cran

Use the --as-cran flag with R CMD check?

stop_on_check_not_passing

Stop if R CMD check does not pass?

clean

Delete the working directory?

debug

For internal use only: Summarize errors for travis?

...

Arguments passed to get_lines_between_tags.

Value

A list containing

pdf_path

The path to the pdf file produced,

txt_path

The path to the text file produced,

html_path

The path to the html file produced,

check_result

A list giving the R CMD check results.

Examples

Run this code
# NOT RUN {
res <- document(file_name = system.file("tests", "files", "minimal.R",
                                        package = "document"),
                check_package = FALSE) # this is for the sake of CRAN cpu
                # time only. _Always_ stick with the default!

# View R CMD check results.
cat(res[["check_result"]][["stdout"]], sep = "\n")
cat(res[["check_result"]][["stderr"]], sep = "\n")

# Copy docmentation to current working directory.
# This writes to your disk, so it's disabled.
# Remove or comment out the next line to enable.
if (FALSE)
    file.copy(res[["pdf_path"]], getwd())
# }

Run the code above in your browser using DataLab