Learn R Programming

docreview

An opinionated package for enhancing your R package documentation.

When writing R packages, high quality documentation can make for a great experience for your users.

You can use docreview to check that your R package documentation passes a number of checks:

  • all exported functions should have documented examples of how to use them
  • vignettes should not be too long
  • vignettes should not be too complex

Installation

# Install the development version from GitHub:
# install.packages("devtools")
devtools::install_github("thisisnic/docreview")

Usage

library(docreview)
pkg_path <- system.file("testpkg", package = "docreview")
package_review(path = pkg_path)

See the vignette for more detailed usage guides.

Current default review checks

  • Vignettes have no more than 2000 words (warn) or 3000 words (fail)
  • Vignettes have no fewer than 100 words (warn) or 0 words (fail)
  • Vignettes have a Flesch-Kincaid readability score lower than 50 (warn) or 30 (fail)
  • All exported functions have examples in their documentation

Copy Link

Version

Install

install.packages('docreview')

Monthly Downloads

169

Version

0.0.1

License

MIT + file LICENSE

Maintainer

Nic Crane

Last Published

August 17th, 2021

Functions in docreview (0.0.1)

find_examples

Get examples from a package
extract_md_section

Extract markdown section
get_config

Set config for docreview checks
vignette_review

Review vignettes
clean_chunks

Clean markdown chunks
get_example

Get example from RD file
find_exports_without_examples

Get exports which don't have any examples
check_results

Check results and raise error if necessary
get_example_code_from_rd

Get example code from parsed RD
remove_links

Remove links from a chunk
analyse_vignette

Analyse a single vignette
parse_vignette

Parse a vignette
get_fk_score

Get Flesch-Kincaid readability score
vignette_results_display

Parse Vignette Results
remove_backticks

Remove any code in backticks from a chunk
find_rd_files

Get RD files from a package
package_review

Review package documentation
get_length

Get number of words in a markdown chunk
find_exported_functions

Get exports
find_vignettes

Find vignettes
function_get_comments

Count failures and warnings for function review
function_review

Review functions
function_results_display

Parse function documentation analysis results