November 4, 2021

Disclaimer

All opinions expressed are those of the presenter and not Merck Sharp & Dohme Corp., a subsidiary of Merck & Co., Inc., Kenilworth, NJ, USA.

Agenda

  • pkglite: compact package representations
  • cleanslate: portable R environments
  • pkglink: runtime package resolution

Reimagine the way to represent an R package

  • A tool for packing and restoring R packages as plaintext assets that are easy to store, transfer, and review
  • A grammar for specifying the file packing scope that is functional, precise, and extendable
  • A standard for exchanging the packed asset that is unambiguous, human-friendly, and machine-readable

pkglite: compact package representations

pkglite is available from CRAN

library("pkglite")

"/path/to/pkg/" %>%
  collate(file_ectd(), file_auto("inst/")) %>%
  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/", install = TRUE)

Website: https://merck.github.io/pkglite/

Reimagine the R environment to use R packages

  • Create a project folder with specific context (.Rproj, .Rprofile, .Renviron)
  • Install a specific version of R into the project folder
  • Install a specific version of Rtools into the project folder
  • (without administrator privileges)

cleanslate: portable R environments

library("cleanslate")

"portable-project/" %>%
  use_project(repo = "https://url/snapshot/2021-11-04/") %>%
  use_rprofile() %>%
  use_renviron() %>%
  use_r_version(version = "4.1.1") %>%
  use_rtools(version = "rtools40")

(Under validation)

Reimagine the way to distribute and import R packages

  • Infrastructure-free: install and load packages from any remote or local files, without CRAN-like repos or Git servers
  • Package aliasing: compile, install, and load packages with aliases at runtime
  • Vectorized loading: install and load multiple packages with one line of code

pkglink: runtime package resolution

pkglink grammar

Thank you