March 5, 2021

Acknowledgements and Disclaimer

  • Many in Biostatistics at Merck have contributed to the development and testing of software!
  • This presentation reflects the views of the author and does not represent a company position for Merck.
  • All errors are the responsibility of the presenter.

Specific Aims

  • Aim 1: To provide a tool for packing and restoring R packages as plaintext assets that are easy to store, transfer, and review.
  • Aim 2: To provide a grammar for specifying the file packing scope that is functional, precise, and extendable.
  • Aim 3: To provide a standard for exchanging the packed asset that is unambiguous, human-friendly, and machine-readable.

pkglite

Solution 1: A Pipe-Friendly Workflow

Connect the verbs by pipes.

library("pkglite")

"/path/to/pkg/" %>%
  collate(file_ectd()) %>%
  pack()

pack(
  "/path/to/pkg1/" %>% collate(file_ectd()),
  "/path/to/pkg2/" %>% collate(file_ectd()),
  output = "/path/to/pkglite.txt"
)

"/path/to/pkglite.txt" %>%
  unpack(output = "/path/to/output/")

Solution 2: File Specifications + File Collections

File specifications offer flexibility and brevity in specifying the files to include.

File specification type Functions
Manual discovery file_spec()
Automatic discovery file_auto()
Common patterns file_root_core(), file_r(), file_man(), file_src(), file_vignettes(), …
Default sets file_default(), file_ectd()

Solution 2: File Specifications + File Collections

File collections contain the evaluation results of file specifications for packing.

library("pkglite")

"/path/to/pkg" %>%
  collate(file_root_core(), file_r(), file_auto("inst/"))

Solution 3: Pkglite.txt Specifications

Pkglite.txt follows the standard Debian Control File (DCF) format used by Debian, R, and RStudio IDE, to be both machine-readable and human-readable.

# Generated by pkglite: do not edit by hand
# Use pkglite::unpack() to restore the packages

Package: pkg1
File: DESCRIPTION
Format: text
Content:
  Package: pkg1
  Type: Package
  Title: Example Package One
  Version: 0.1.0

pkglite in action

Lively discussions