Package: Require 1.0.1

Eliot J B McIntire

Require: Installing and Loading R Packages for Reproducible Workflows

A single key function, 'Require' that makes rerun-tolerant versions of 'install.packages' and `require` for CRAN packages, packages no longer on CRAN (i.e., archived), specific versions of packages, and GitHub packages. This approach is developed to create reproducible workflows that are flexible and fast enough to use while in development stages, while able to build snapshots once a stable package collection is found. As with other functions in a reproducible workflow, this package emphasizes functions that return the same result whether it is the first or subsequent times running the function, with subsequent times being sufficiently fast that they can be run every time without undue waiting burden on the user or developer.

Authors:Eliot J B McIntire [aut, cre], Alex M Chubaty [ctb], Her Majesty the Queen in Right of Canada, as represented by the Minister of Natural Resources Canada [cph]

Require_1.0.1.tar.gz
Require_1.0.1.zip(r-4.5)Require_1.0.1.zip(r-4.4)Require_1.0.1.zip(r-4.3)
Require_1.0.1.tgz(r-4.4-any)Require_1.0.1.tgz(r-4.3-any)
Require_1.0.1.tar.gz(r-4.5-noble)Require_1.0.1.tar.gz(r-4.4-noble)
Require_1.0.1.tgz(r-4.4-emscripten)Require_1.0.1.tgz(r-4.3-emscripten)
Require.pdf |Require.html
Require/json (API)
NEWS

# Install 'Require' in R:
install.packages('Require', repos = c('https://predictiveecology.r-universe.dev', 'https://cloud.r-project.org'))

Peer review:

Bug tracker:https://github.com/predictiveecology/require/issues

On CRAN:

47 exports 19 stars 3.57 score 2 dependencies 13 dependents 145 scripts 1.7k downloads

Last updated 1 months agofrom:3940f0619c (on development). Checks:OK: 7. Indexed: yes.

TargetResultDate
Doc / VignettesOKSep 06 2024
R-4.5-winOKSep 06 2024
R-4.5-linuxOKSep 06 2024
R-4.4-winOKSep 06 2024
R-4.4-macOKSep 06 2024
R-4.3-winOKSep 06 2024
R-4.3-macOKSep 06 2024

Exports:.downloadFileMasterMainAuthcacheClearPackagescacheDefaultDircacheDircacheGetOptionCachePkgDircachePkgDircachePurgecheckPathclearRequirePackageCachecompareVersion2detachAlldlArchiveVersionsAvailabledlGitHubDESCRIPTIONextractInequalityextractPkgGitHubextractPkgNameextractVersionNumbergetCRANreposgetRequireOptionsInstallinvertListmessageDFmessageVerbosemodifyList2modifyList3normPathpaddedFloatToCharparseGitHubpkgDeppkgDep2pkgDepIfDepRemovedpkgDepTopoSortpkgSnapshotpkgSnapshot2purgeCacheRequireRequireOptionssetdiffNamedsetLibPathssetLinuxBinaryReposetupsetupOffsourcePkgstempdir2tempfile2trimVersionNumberupdatePackages

Dependencies:data.tablesys

The Require approach, comparing pak and renv

Rendered fromRequire.Rmdusingknitr::rmarkdownon Sep 06 2024.

Last update: 2024-07-30
Started: 2024-07-26

Readme and manuals

Help Manual

Help pageTopics
Require: Installing and Loading R Packages for Reproducible WorkflowsRequire-package Install Require
GITHUB_PAT-aware and 'main'-'master'-aware download from GitHub.downloadFileMasterMainAuth
Partial alternative (faster) to 'installed.packages'.installed.pkgs
Create a custom "available.packages" objectavailablePackagesOverride
Needs 'VersionOnRepos', 'versionSpec' and 'inequality' columnsavailableVersionOK
Clear Require Cache elementscacheClearPackages clearRequirePackageCache
The default cache directory for Require CachecacheDefaultDir
Path to (package) cache directorycacheDir cachePkgDir
Get the option for 'Require.cachePkgDir'cacheGetOptionCachePkgDir
Purge everything in the Require cachecachePurge purgeCache
Creates the directories, and adds version numbercheckLibPaths
Check directory pathcheckPath checkPath,character,logical-method checkPath,character,missing-method checkPath,missing,ANY-method checkPath,NULL,ANY-method
Compare package versionscompareVersion2
Only checks for deprecated libPath argument (singular)dealWithMissingLibPaths
GitHub package toolsDESCRIPTIONFileOtherV DESCRIPTIONFileVersionV dlGitHubDESCRIPTION
Detach and unload all packagesdetachAll
Available and archived versionsavailable.packagesCached dlArchiveVersionsAvailable
Deals with missing libPaths arg, and takes firstdoLibPaths
1st level -> create the .pkgEnv object in RequireenvPkgCreate
3rd level for deps #############################################envPkgDepDepsCreate
3rd level for DESCRIPTIONFileenvPkgDepDESCFileCreate
Extract info from package character stringsextractInequality extractPkgGitHub extractPkgName extractVersionNumber
The 'packages' argument may have up to 4 pieces of information for GitHub packages: name, repository, branch, version. For CRAN-alikes, it will only be 2 pieces: name, version. There can also be an inequality or equality, if there is a version.getDeps
Invert a 2-level listinvertList
Join a data.table with a 'Package' column to 'available.packages'joinToAvailablePackages
Create link to file, falling back to making a copy if linking fails.fileRenameOrMove linkOrCopy
This converts master or main to HEAD for a git repomasterMainToHead
Use message to print a clean square data structuremessageDF messageVerbose messageVerboseCounter
'modifyList' for multiple listsmodifyList2 modifyList3
Normalize filepathnormPath normPath,character-method normPath,list-method normPath,logical-method normPath,missing-method normPath,NULL-method
Convert numeric to character with paddingpaddedFloatToChar
2nd levelpakEnv
Parse a github package specificationparseGitHub
2nd levelpkgDepEnv
Package dependencies when one or more packages removedpkgDepIfDepRemoved
Reverse package dependspkgDep pkgDep2 pkgDepTopoSort
Take a snapshot of all the packages and version numberspkgSnapshot pkgSnapshot2
'Require' optionsgetRequireOptions RequireOptions
Recursive function to remove '.basePkgs'rmBase
R versionsrversions
Like 'setdiff', but takes into account namessetdiffNamed
Set '.libPaths'setLibPaths
Setup for binary Linux repositoriessetLinuxBinaryRepo
Setup a project library, cache, optionssetup setupOff
A list of R packages that should likely be installed from Source, not BinarysourcePkgs
'split' for a data.table that keeps integrity of a column of lists of data.table objectssplitKeepOrderAndDTIntegrity
download.files or install.packages in a separate processsysInstallAndDownload
Make a temporary (sub-)directorytempdir2
Make a temporary subfile in a temporary (sub-)directorytempfile2
Trim version number off a compound package nametrimVersionNumber
Update installed packages with latest available versionsupdatePackages