Description Usage Arguments Details Value Examples
Generate a requirements file from existing file(s) and installed packages
1 2 3 4 5 6 7 | rip_freeze(output_path = "requirements.txt", eq_sym = ">=",
inspect_files = c("R", "Rmd", "Rpres", "lock"), path = ".",
recursive = TRUE, rm_missing = FALSE)
generate_requirements(output_path = "requirements.txt", eq_sym = ">=",
inspect_files = c("R", "Rmd", "Rpres", "lock"), path = ".",
recursive = TRUE, rm_missing = FALSE)
|
output_path |
String indicating where to write resulting requirements file to. |
eq_sym |
The equality symbol to be used when writing requirements (i.e. package>=1.0.0).
Use |
inspect_files |
Character vector of file extensions to search for dependencies in. Officially supports the following extensions: 'c("R", "Rmd", "Rpres", "lock")'. Other extensions will be processed as if they were '.R' files. |
path |
Location where extensions from 'inspect_files' should be searched for. (see 'path' from '?list.files'). |
recursive |
Should the seatch for 'inspect_files' recurse into directories? (see 'recursive' from '?list.files'). |
rm_missing |
Should packages not installed locally be excluded from output? |
If '"lock"' is included in 'inspect_files', it is assumed to refer to a 'packrat.lock'. Only files matching the pattern 'glob2rx("*packrat/packrat.lock")' will be considered.
Methodology for package matching relies on string pattern matching rather than a more sophisticated method.
This will match most 'standard' ways of referencing libraries in R code.
The following lines of code show examples where the data.table
package will be matched properly:
library(data.table)
library("data.table")
library(data.table, warn.conflicts = TRUE)
require(data.table)
require("data.table")
require(data.table, quietly = TRUE)
pacman::p_load(data.table)
pacman::p_load("data.table")
pacman::p_load(data.table, install = FALSE)
data.table::data.table()
data.table:::data.table()
Matching will fail if:
loading multiple packages with pacman::p_load
(only the first package will be matched)
using a character vector to load; e.g. pkg = "testthat"; library(pkg, character.only = TRUE)
(will match pkg
as package instead of testthat
)
using a string resembling a package load; e.g. "library(fake.package)"
(will match fake.package
)
Nothing is returned. Results are written to output_path
1 2 3 4 5 6 7 8 | ## Not run:
rip_freeze("R/*.R")
rip_freeze("R/*.R", output_path = "my_requirements.txt")
rip_freeze("R/*.R", output_path = "equal_to_requirements.txt", eq_sym = "==")
rip_freeze("R/*.R", output_path = "versionless_requirements.txt", eq_sym = NULL)
rip_freeze("R/*.R", output_path = "installed_requirements.txt", rm_missing = TRUE)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.