Sinew: a R Package to create self-populating roxygen2 skeletons

Sinew is a R package that generates a roxygen2 skeletons populated with information scraped from within the function script.

The goal of the package is to automate nearly all of the mundane tasks needed to document functions, properly set up the import fields for oxygenation, and make it easier to attain documentation consistency across functions. 

Functionality

  • makeOxygen: Create a skeleton for roxygen2 documentation populated with information scraped from within the package function scripts.
  • makeImport: Create import(s) calls for DESCRIPTION, NAMESPACE, and roxygen2.
  • makeDictionary: Create a R file of all the unique roxygen2 parameter fields in a package R subdirectory.

Installation

#CRAN
install.packages('sinew')

#DEV
devtools::install_github('metrumresearchgroup/sinew')

Example Output

[[code]]czo3Mjk6XCJtYWtlT3h5Z2VuKGxtKQojXCcgQHRpdGxlIEZVTkNUSU9OX1RJVExFCiNcJyBAZGVzY3JpcHRpb24gRlVOQ1RJT05fREVTQ3tbJiomXX1SSVBUSU9OCiNcJyBAcGFyYW0gZm9ybXVsYSBQQVJBTV9ERVNDUklQVElPTgojXCcgQHBhcmFtIGRhdGEgUEFSQU1fREVTQ1JJUFRJT057WyYqJl19CiNcJyBAcGFyYW0gc3Vic2V0IFBBUkFNX0RFU0NSSVBUSU9OCiNcJyBAcGFyYW0gd2VpZ2h0cyBQQVJBTV9ERVNDUklQVElPTgojXCcgQHtbJiomXX1wYXJhbSBuYS5hY3Rpb24gUEFSQU1fREVTQ1JJUFRJT04KI1wnIEBwYXJhbSBtZXRob2QgUEFSQU1fREVTQ1JJUFRJT04sIERlZmF1bHtbJiomXX10OiBcJ3FyXCcKI1wnIEBwYXJhbSBtb2RlbCBQQVJBTV9ERVNDUklQVElPTiwgRGVmYXVsdDogVFJVRQojXCcgQHBhcmFtIHggUEFSQU1fRHtbJiomXX1FU0NSSVBUSU9OLCBEZWZhdWx0OiBGQUxTRQojXCcgQHBhcmFtIHkgUEFSQU1fREVTQ1JJUFRJT04sIERlZmF1bHQ6IEZBTFNFCiNcJyB7WyYqJl19QHBhcmFtIHFyIFBBUkFNX0RFU0NSSVBUSU9OLCBEZWZhdWx0OiBUUlVFCiNcJyBAcGFyYW0gc2luZ3VsYXIub2sgUEFSQU1fREVTQ1J7WyYqJl19SVBUSU9OLCBEZWZhdWx0OiBUUlVFCiNcJyBAcGFyYW0gY29udHJhc3RzIFBBUkFNX0RFU0NSSVBUSU9OLCBEZWZhdWx0OiBOVUxMCiN7WyYqJl19XCcgQHBhcmFtIG9mZnNldCBQQVJBTV9ERVNDUklQVElPTgojXCcgQHBhcmFtIC4uLiBQQVJBTV9ERVNDUklQVElPTgojXCcgQHJldHVybntbJiomXX0gT1VUUFVUX0RFU0NSSVBUSU9OCiNcJyBAaW1wb3J0RnJvbSBzdGF0cyBtb2RlbC5mcmFtZVwiO3tbJiomXX0=[[/code]]

In more detail…

For new developers, getting a package ready for building and submitting to CRAN is an expletive-filled, head-scratching experience to say the least. Trying to figure out the basics of what goes in depends and what goes in imports is a lost afternoon most of us would like back. Once that is understood, filling in relevant information to each field is a mundane task even for a well polished package developer. The out-of-the-box roxygen2 skeleton supplied by RStudio gives the bare bones road map of what should be part of function documentation:
#stats::lm skeleton example

#' Title
#'
#' @param formula 
#' @param data 
#' @param subset 
#' @param weights 
#' @param na.action 
#' @param method 
#' @param model 
#' @param x 
#' @param y 
#' @param qr 
#' @param singular.ok 
#' @param contrasts 
#' @param offset 
#' @param ... 
#'
#' @return
#' @export
#'
#' @examples
There is a lot of heavy lifting still left to do: 
  • Are there default values for the parameter?
  • What namespaces are used in the function that need to be imported?
  • What are the best candidates for seealso links?
  • Should other roxygen2 fields be used to make better documentation?

Package Functionality

  • makeOxygen: Create a skeleton for roxygen2 documentation populated with information scraped from within the package function scripts.
  • makeImport: Create import(s) calls for DESCRIPTION, NAMESPACE, and roxygen2.
  • makeDictionary: Create a R file of all the unique roxygen2 parameter fields in a package R subdirectory.

makeOxygen

 
Function that returns the skeleton for roxygen2 documentation including title, description, return, import, and other fields populated with information scraped from the function script.

Basic Usage

makeOxygen is the main function in the package. Running the default setting returns a skeleton with minimal required fields to run [code]]czo0MTpcImRldnRvb2xzOjpjaGVjayhidWlsZF9hcmdzID0gXCctLWFzLWNyYW5cJylcIjt7WyYqJl19[[/code]: title, description, param, and return.

Adding Some Meat to the Bones…

The added value of sinew is that it scrapes the script and fills in many important holes in the documentation:
  • param default values:
    • If a default value is set for a function parameter it will be added to the end [code]]czo2OlwiQHBhcmFtXCI7e1smKiZdfQ==[[/code] line.
  • import/importFrom
    • It is assumed that the developer is abiding by the CRAN rules and uses the proper namespace syntax [code]]czoxNzpcInBhY2thZ2U6OmZ1bmN0aW9uXCI7e1smKiZdfQ==[[/code] when calling functions in the script. The package scrapes the script with [code]]czoxMDpcIm1ha2VJbXBvcnRcIjt7WyYqJl19[[/code] to create the valid calls for [code]]czo3OlwiQGltcG9ydFwiO3tbJiomXX0=[[/code] and [code]]czoxMTpcIkBpbXBvcnRGcm9tXCI7e1smKiZdfQ==[[/code] which are placed at the bottom of the output. The user has control over the number of functions that are listed in [code]]czo0NTpcImltcG9ydEZyb20gcGFja2FnZSBmdW5jdGlvbjEgWyBmdW5jdGlvbjIgLi4uXVwiO3tbJiomXX0=[[/code] until only [code]]czoxNTpcIkBpbXBvcnQgcGFja2FnZVwiO3tbJiomXX0=[[/code] is returned (more below).
  • seealso
    • Linking to other packages is also taken care of when adding the field [code]]czo4OlwiQHNlZWFsc29cIjt7WyYqJl19[[/code]. Any functions that are included in [code]]czoxMTpcIkBpbXBvcnRGcm9tXCI7e1smKiZdfQ==[[/code] will have a link to them by default.
Examples showing different parameter specification in makeOxygen

Basic

[[code]]czo3Mjk6XCJtYWtlT3h5Z2VuKGxtKQojXCcgQHRpdGxlIEZVTkNUSU9OX1RJVExFCiNcJyBAZGVzY3JpcHRpb24gRlVOQ1RJT05fREVTQ3tbJiomXX1SSVBUSU9OCiNcJyBAcGFyYW0gZm9ybXVsYSBQQVJBTV9ERVNDUklQVElPTgojXCcgQHBhcmFtIGRhdGEgUEFSQU1fREVTQ1JJUFRJT057WyYqJl19CiNcJyBAcGFyYW0gc3Vic2V0IFBBUkFNX0RFU0NSSVBUSU9OCiNcJyBAcGFyYW0gd2VpZ2h0cyBQQVJBTV9ERVNDUklQVElPTgojXCcgQHtbJiomXX1wYXJhbSBuYS5hY3Rpb24gUEFSQU1fREVTQ1JJUFRJT04KI1wnIEBwYXJhbSBtZXRob2QgUEFSQU1fREVTQ1JJUFRJT04sIERlZmF1bHtbJiomXX10OiBcJ3FyXCcKI1wnIEBwYXJhbSBtb2RlbCBQQVJBTV9ERVNDUklQVElPTiwgRGVmYXVsdDogVFJVRQojXCcgQHBhcmFtIHggUEFSQU1fRHtbJiomXX1FU0NSSVBUSU9OLCBEZWZhdWx0OiBGQUxTRQojXCcgQHBhcmFtIHkgUEFSQU1fREVTQ1JJUFRJT04sIERlZmF1bHQ6IEZBTFNFCiNcJyB7WyYqJl19QHBhcmFtIHFyIFBBUkFNX0RFU0NSSVBUSU9OLCBEZWZhdWx0OiBUUlVFCiNcJyBAcGFyYW0gc2luZ3VsYXIub2sgUEFSQU1fREVTQ1J7WyYqJl19SVBUSU9OLCBEZWZhdWx0OiBUUlVFCiNcJyBAcGFyYW0gY29udHJhc3RzIFBBUkFNX0RFU0NSSVBUSU9OLCBEZWZhdWx0OiBOVUxMCiN7WyYqJl19XCcgQHBhcmFtIG9mZnNldCBQQVJBTV9ERVNDUklQVElPTgojXCcgQHBhcmFtIC4uLiBQQVJBTV9ERVNDUklQVElPTgojXCcgQHJldHVybntbJiomXX0gT1VUUFVUX0RFU0NSSVBUSU9OCiNcJyBAaW1wb3J0RnJvbSBzdGF0cyBtb2RlbC5mcmFtZVwiO3tbJiomXX0=[[/code]]

Add_fields

Control over which roxygen2 fields are added to the header is passed through [code]]czoxMDpcImFkZF9maWVsZHNcIjt7WyYqJl19[[/code].
[[code]]czo1NjY6XCJtYWtlT3h5Z2VuKGNvbG91cnBpY2tlcjo6OmNvbG91clBpY2tlckdhZGdldCxhZGRfZmllbGRzID0gYyhcJ2V4cG9ydFwnLHtbJiomXX1cJ2RldGFpbHNcJyxcJ2V4YW1wbGVzXCcpKQojXCcgQHRpdGxlIEZVTkNUSU9OX1RJVExFCiNcJyBAZGVzY3JpcHRpb24gRlVOQ1RJT05fREVTe1smKiZdfUNSSVBUSU9OCiNcJyBAcGFyYW0gbnVtQ29scyBQQVJBTV9ERVNDUklQVElPTiwgRGVmYXVsdDogMwojXCcgQHJldHVybiBPVVRQVVRfRHtbJiomXX1FU0NSSVBUSU9OCiNcJyBAZXhwb3J0CiNcJyBAZGV0YWlscyBERVRBSUxTCiNcJyBAZXhhbXBsZXMKI1wnIEVYQU1QTEUxIAojXCcgQGltcG97WyYqJl19cnRGcm9tIGNvbG91cnBpY2tlciBjb2xvdXJJbnB1dCB1cGRhdGVDb2xvdXJJbnB1dAojXCcgQGltcG9ydEZyb20gZ3JEZXZpY2VzIGN7WyYqJl19b2xvdXJzCiNcJyBAaW1wb3J0RnJvbSBzaGlueSBhZGRSZXNvdXJjZVBhdGggZGlhbG9nVmlld2VyIHJ1bkdhZGdldCBzaGlueUFwcAp7WyYqJl19I1wnIEBpbXBvcnRGcm9tIHNoaW55anMgdXNlU2hpbnlqcyBleHRlbmRTaGlueWpzIHRvZ2dsZVN0YXRlIGRpc2FibGUgb25jbGljayB7WyYqJl19YWxlcnQKI1wnIEBpbXBvcnRGcm9tIHV0aWxzIHBhY2thZ2VWZXJzaW9uXCI7e1smKiZdfQ==[[/code]]

Cut

Passing [code]]czozOlwiY3V0XCI7e1smKiZdfQ==[[/code] to makeOxygen to return [code]]czoxNDpcImltcG9ydCBwYWNrYWdlXCI7e1smKiZdfQ==[[/code] instead of [code]]czo0NDpcImltcG9ydEZyb20gcGFja2FnZSBmdW5jdGlvbjEgW2Z1bmN0aW9uMiAuLi5dXCI7e1smKiZdfQ==[[/code] for packages that call more than the value assigned to cut.
[[code]]czo0NjI6XCImZ3Q7IG1ha2VPeHlnZW4oY29sb3VycGlja2VyOjo6Y29sb3VyUGlja2VyR2FkZ2V0LGFkZF9maWVsZHMgPSBjKFwnZXhwe1smKiZdfW9ydFwnLFwnZGV0YWlsc1wnLFwnZXhhbXBsZXNcJyksY3V0PTMpCiNcJyBAdGl0bGUgRlVOQ1RJT05fVElUTEUKI1wnIEBkZXNjcmlwdGlvbiBGe1smKiZdfVVOQ1RJT05fREVTQ1JJUFRJT04KI1wnIEBwYXJhbSBudW1Db2xzIFBBUkFNX0RFU0NSSVBUSU9OLCBEZWZhdWx0OiAzCiNcJyBAcmV0dXtbJiomXX1ybiBPVVRQVVRfREVTQ1JJUFRJT04KI1wnIEBleHBvcnQKI1wnIEBkZXRhaWxzIERFVEFJTFMKI1wnIEBleGFtcGxlcwojXCcgRVhBTVBMRXtbJiomXX0xIAojXCcgQGltcG9ydEZyb20gY29sb3VycGlja2VyIGNvbG91cklucHV0IHVwZGF0ZUNvbG91cklucHV0CiNcJyBAaW1wb3J0RnJvbSB7WyYqJl19Z3JEZXZpY2VzIGNvbG91cnMKI1wnIEBpbXBvcnQgc2hpbnkKI1wnIEBpbXBvcnQgc2hpbnlqcwojXCcgQGltcG9ydEZyb20gdXRpbHMgcHtbJiomXX1hY2thZ2VWZXJzaW9uXCI7e1smKiZdfQ==[[/code]]

Seealso

When calling [code]]czoyMDpcImFkZGZpZWxkcyhcJ3NlZWFsc29cJylcIjt7WyYqJl19[[/code] the function will guess which functions to add conditional on the value cut it is set to. That is, any function returned with importFrom will also have a seealso link created for it.
[[code]]czo3MjQ6XCImZ3Q7IG1ha2VPeHlnZW4oc2hpbnlIZWF0bWFwbHk6OjpoZWF0bWFwbHlHYWRnZXQsY3V0PTMsYWRkX2ZpZWxkcyA9IFwne1smKiZdfXNlZWFsc29cJykKI1wnIEB0aXRsZSBGVU5DVElPTl9USVRMRQojXCcgQGRlc2NyaXB0aW9uIEZVTkNUSU9OX0RFU0NSSVBUSU9OCiNcJyBAe1smKiZdfXBhcmFtIG9iaiBQQVJBTV9ERVNDUklQVElPTgojXCcgQHBhcmFtIHBsb3RIZWlnaHQgUEFSQU1fREVTQ1JJUFRJT04sIERlZmF1bHQ6e1smKiZdfSA4MDAKI1wnIEBwYXJhbSB2aWV3ZXJUeXBlIFBBUkFNX0RFU0NSSVBUSU9OLCBEZWZhdWx0OiBcJ3BhbmVWaWV3ZXJcJwojXCcgQHBhcmFte1smKiZdfSAuLi4gUEFSQU1fREVTQ1JJUFRJT04KI1wnIEByZXR1cm4gT1VUUFVUX0RFU0NSSVBUSU9OCiNcJyBAc2VlYWxzbwojXCcgIFxcY29kZXtcXHtbJiomXX1saW5rW0RUXXtkYXRhVGFibGVPdXRwdXR9fSxcXGNvZGV7XFxsaW5rW0RUXXtyZW5kZXJEYXRhVGFibGV9fQojXCcgIFxcY29kZXtcXGxpbmt7WyYqJl19W3Rvb2xzXXtmaWxlX3BhdGhfc2Fuc19leHR9fQojXCcgIFxcY29kZXtcXGxpbmtbeHRhYmxlXXt4dGFibGV9fQojXCcgQGltcG9ydEZyb217WyYqJl19IERUIGRhdGFUYWJsZU91dHB1dCByZW5kZXJEYXRhVGFibGUKI1wnIEBpbXBvcnQgaGVhdG1hcGx5CiNcJyBAaW1wb3J0IGh0bWx0b29se1smKiZdfXMKI1wnIEBpbXBvcnQgcGxvdGx5CiNcJyBAaW1wb3J0IHNoaW55CiNcJyBAaW1wb3J0IHN0YXRzCiNcJyBAaW1wb3J0RnJvbSB0b29scyBme1smKiZdfWlsZV9wYXRoX3NhbnNfZXh0CiNcJyBAaW1wb3J0RnJvbSB4dGFibGUgeHRhYmxlClwiO3tbJiomXX0=[[/code]]

Dictionary

A dictionary is a R file produced with makeDictionary. This R file contains all the unique roxygen2 parameter fields in a package R subdirectory. makeOxygen uses the parameter in the dictionary and, if found, it returns the dictionary entry instead of the default output (more details at the end of the post…).
[[code]]czo3ODY6XCJtYWtlT3h5Z2VuKHNpbmV3Ojp0YWJ1bGFyLGFkZF9maWVsZHMgPSBjKFwnZXhhbXBsZXNcJyxcJ2V4cG9ydFwnKSkKCiNcJyBAdHtbJiomXX1pdGxlIEZVTkNUSU9OX1RJVExFCiNcJyBAZGVzY3JpcHRpb24gRlVOQ1RJT05fREVTQ1JJUFRJT04KI1wnIEBwYXJhbSBkZiBQQVJBTV97WyYqJl19REVTQ1JJUFRJT04KI1wnIEBwYXJhbSBoZWFkZXIgUEFSQU1fREVTQ1JJUFRJT04sIERlZmF1bHQ6IFRSVUUKI1wnIEBwYXJhbSAuLi4ge1smKiZdfVBBUkFNX0RFU0NSSVBUSU9OCiNcJyBAcmV0dXJuIE9VVFBVVF9ERVNDUklQVElPTgojXCcgQGV4YW1wbGVzIAojXCcgRVhBTVBMRTEgCiN7WyYqJl19XCcKI1wnIEBleHBvcnQgCgpkaWN0X2xvYz1cJ2h0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9tZXRydW1yZXNlYXJjaGdyb3tbJiomXX11cC9zaW5ldy9tYXN0ZXIvbWFuLXJveHlnZW4vRGljdGlvbmFyeS0xLlJcJwoKbWFrZU94eWdlbihzaW5ldzo6dGFidWxhcix1c2VfZHtbJiomXX1pY3Rpb25hcnkgPSBkaWN0X2xvYyxhZGRfZmllbGRzID0gYyhcJ2V4YW1wbGVzXCcsXCdleHBvcnRcJykpCgojXCcgQHRpdGxlIEZVTkNUSU97WyYqJl19Tl9USVRMRQojXCcgQGRlc2NyaXB0aW9uIEZVTkNUSU9OX0RFU0NSSVBUSU9OCiNcJyBAcGFyYW0gZGYgZGF0YS5mcmFtZSB0byBjb252e1smKiZdfWVydCB0byB0YWJsZQojXCcgQHBhcmFtIGhlYWRlciBib29sZWFuIHRvIGNvbnRyb2wgaWYgaGVhZGVyIGlzIGNyZWF0ZWQgZnJvbSBue1smKiZdfWFtZXMoZGYpLCBEZWZhdWx0OiBUUlVFCiNcJyBAcGFyYW0gLi4uCiNcJyBAcmV0dXJuIE9VVFBVVF9ERVNDUklQVElPTgojXCcgQGV4YW17WyYqJl19cGxlcyAKI1wnIEVYQU1QTEUxIAojXCcKI1wnIEBleHBvcnQgXCI7e1smKiZdfQ==[[/code]]

Data.frames

makeOxygen also creates documentation for data.frames and tibble objects
[[code]]czo0NDY6XCJtYWtlT3h5Z2VuKGlyaXMpCiNcJyBAdGl0bGUgREFUQVNFVF9USVRMRQojXCcgQGRlc2NyaXB0aW9uIERBVEFTRVRfREVTQ3tbJiomXX1SSVBUSU9OCiNcJyBAZm9ybWF0IEEgZGF0YSBmcmFtZSB3aXRoIDE1MCByb3dzIGFuZCA1IHZhcmlhYmxlczoKI1wnIFxcZGVzY3JpYmV7e1smKiZdfQojXCcgICBcXGl0ZW17XFxjb2Rle1NlcGFsLkxlbmd0aH19e2RvdWJsZSBDT0xVTU5fREVTQ1JJUFRJT059CiNcJyAgIFxcaXRlbXtcXGNvZGV7WyYqJl19e1NlcGFsLldpZHRofX17ZG91YmxlIENPTFVNTl9ERVNDUklQVElPTn0KI1wnICAgXFxpdGVte1xcY29kZXtQZXRhbC5MZW5ndGh9fXtkb3tbJiomXX11YmxlIENPTFVNTl9ERVNDUklQVElPTn0KI1wnICAgXFxpdGVte1xcY29kZXtQZXRhbC5XaWR0aH19e2RvdWJsZSBDT0xVTU5fREVTQ1JJe1smKiZdfVBUSU9OfQojXCcgICBcXGl0ZW17XFxjb2Rle1NwZWNpZXN9fXtpbnRlZ2VyIENPTFVNTl9ERVNDUklQVElPTn0gCiNcJ30KXCJpcmlzXCJcIjt7WyYqJl19[[/code]]

makeImport

When building a package to submit to CRAN, you need to have namespace calls for any function that is being imported. It is a pain to manually parse through the code looking for all the [code]]czo0OlwiKjo6KlwiO3tbJiomXX0=[[/code] and writing it in the roxygen2 header. This function does that for you. You can write your script normally with the namespace calls and in the end run the function and you can paste the output into the header (or use it as part of [code]]czoxMDpcIm1ha2VPeHlnZW5cIjt7WyYqJl19[[/code]). The function is written to work on single files or whole directories, like a package R subdirectory. The output can be set to return the format needed for either an roxygen2 header, NAMESPACE or the DESCRIPTION.

DESCRIPTION

[[code]]czoxMDg6XCJtYWtlSW1wb3J0KHNjcmlwdD1saXN0LmZpbGVzKFwnUlwnLGZ1bGwubmFtZXMgPSBUKSxwcmludCA9IFQsZm9ybWF0ID0gXCd7WyYqJl19ZGVzY3JpcHRpb25cJykKSW1wb3J0czogcnN0dWRpb2FwaSx1dGlsc1wiO3tbJiomXX0=[[/code]]

NAMESPACE

[[code]]czoyMDE6XCJtYWtlSW1wb3J0KHNjcmlwdD1saXN0LmZpbGVzKFwnUlwnLGZ1bGwubmFtZXMgPSBUKSxwcmludCA9IFQsZm9ybWF0ID0gXCd7WyYqJl19bmFtZXNwYWNlXCcpCiAKaW1wb3J0RnJvbShyc3R1ZGlvYXBpLGdldEFjdGl2ZURvY3VtZW50Q29udGV4dCkKaW1wb3J0RnJvbShyc3R7WyYqJl19dWRpb2FwaSxpbnNlcnRUZXh0KQppbXBvcnRGcm9tKHV0aWxzLGluc3RhbGxlZC5wYWNrYWdlcylcIjt7WyYqJl19[[/code]]

roxygen2

[[code]]czozMjA6XCJtYWtlSW1wb3J0KHNjcmlwdD1saXN0LmZpbGVzKFwnUlwnLGZ1bGwubmFtZXMgPSBUKSxwcmludCA9IFQsZm9ybWF0ID0gXCd7WyYqJl19b3h5Z2VuXCcpCiAKUi9pbXBvcnRBZGRpbi5SCiNcJyBAaW1wb3J0RnJvbSByc3R1ZGlvYXBpIGdldEFjdGl2ZURvY3VtZW50Q29udGV4e1smKiZdfXQKIApSL21ha2VJbXBvcnQuUgojXCcgQGltcG9ydEZyb20gdXRpbHMgaW5zdGFsbGVkLnBhY2thZ2VzCiAKUi9tYWtlT3h5Z2VuLlIKe1smKiZdfQogClIvbWFrZVNlZUFsc28uUgoKIApSL294eWdlbkFkZGluLlIKI1wnIEBpbXBvcnRGcm9tIHJzdHVkaW9hcGkgZ2V0QWN0aXZlRG9je1smKiZdfXVtZW50Q29udGV4dCBpbnNlcnRUZXh0XCI7e1smKiZdfQ==[[/code]]

importFrom cutoff

Setting cut to a value allows for the control over how many functions to list in a package before concatenating the [code]]czoxMDpcImltcG9ydEZyb21cIjt7WyYqJl19[[/code] to an [code]]czo2OlwiaW1wb3J0XCI7e1smKiZdfQ==[[/code]. This is useful when there are many functions being used throughout the package from the same library and it is practically the same as just importing the whole library
[[code]]czoyNTY6XCJtYWtlSW1wb3J0KHNjcmlwdD1cJ1Ivb3h5Z2VuQWRkaW4uUlwnLHByaW50ID0gVCxmb3JtYXQgPSBcJ294eWdlblwnKQoKUi9ve1smKiZdfXh5Z2VuQWRkaW4uUgojXCcgQGltcG9ydEZyb20gcnN0dWRpb2FwaSBnZXRBY3RpdmVEb2N1bWVudENvbnRleHQgaW5zZXJ0VGV4dAoge1smKiZdfQptYWtlSW1wb3J0KHNjcmlwdD1cJ1Ivb3h5Z2VuQWRkaW4uUlwnLHByaW50ID0gVCxmb3JtYXQgPSBcJ294eWdlblwnLGN1dD0yKQogClIve1smKiZdfW94eWdlbkFkZGluLlIKI1wnIEBpbXBvcnQgcnN0dWRpb2FwaVwiO3tbJiomXX0=[[/code]]

makeDictionary

This function takes the idea of roxygen2 templates, but repurposes their use. It creates an R file of all the unique roxygen2 parameter fields in a package R subdirectory. This serves a few functions:
  • Creates a general template for regular use with roxygen2,
  • Provides a simple way to check that there are no redundant parameter descriptions and that they are consistent,
  • When present, this is used internally with ls_param to call parameter descriptions in bulk from a centralized template to populate makeOxygen skeletons.
For example in the man-roxygen there is a Dictionary-1.R file that was created by makeDictionary. Using ls_param a query is run on the dictionary to return the param fields that intersect with the formals call to the functions.
[[code]]czo1NTc6XCJkaWN0X2xvYz1cJ2h0dHBzOi8vcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbS9tZXRydW1yZXNlYXJjaGdyb3VwL3NpbmV3e1smKiZdfS9tYXN0ZXIvbWFuLXJveHlnZW4vRGljdGlvbmFyeS0xLlJcJwoKbHNfcGFyYW0oc2luZXc6Om1ha2VPeHlnZW4sZGljdGlvbmFyeSA9e1smKiZdfSBkaWN0X2xvYykKCiNcJyBAcGFyYW0gb2JqIGZ1bmN0aW9uIG9yIG5hbWUgb2YgZnVuY3Rpb24KI1wnIEBwYXJhbSBhZGRfZGVmYXVsdHtbJiomXX0gYm9vbGVhbiB0byBhZGQgZGVmYXVsdHMgdmFsdWVzIHRvIHRoZSBlbmQgb2YgdGhlIFBBUkFNIGZpZWxkcywgRGVmYXVsdDogVFJVe1smKiZdfUUKI1wnIEBwYXJhbSBhZGRfZmllbGRzIGNoYXJhY3RlciB2ZWN0b3IgdG8gYWRkIGFkZGl0aW9uYWwgcm94eWdlbiBmaWVsZHMsIERle1smKiZdfWZhdWx0OiBOVUxMCiNcJyBAcGFyYW0gcHJpbnQgYm9vbGVhbiBwcmludCBvdXRwdXQgdG8gY29uc29sZSwgRGVmYXVsdDogVFJVRQoje1smKiZdfVwnIEBwYXJhbSAuLi4gCgpuYW1lcyhmb3JtYWxzKG1ha2VPeHlnZW4pKQpbMV0gXCJvYmpcIiAgICAgICAgIFwiYWRkX2RlZmF1bHRcIiBcImF7WyYqJl19ZGRfZmllbGRzXCIgIFwicHJpbnRcIiAgICAgICBcIi4uLlwiIFwiO3tbJiomXX0=[[/code]]
 

Jonathan Sidi joined Metrum Research Group in 2016 after working for several years on problems in applied statistics, financial stress testing, and economic forecasting in both industrial and academic settings. To learn more about additional open-source software packages developed by Metrum Research Group please visit the Metrum website. Contact: For questions and comments, feel free to email me at: [email protected] or open an issue for bug fixes or enhancements at github.

Published by

Jonathan Sidi

Data welder 👨‍🏭 and research associate at Metrum Research Group. Developer of R packages ggedit, slickR, fluidSpline and texPreview.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.