rip_freeze: Generate a requirements.txt for your project

Description Usage Arguments Details Value Examples

View source: R/rip_freeze.R

Description

Generate a requirements file from existing file(s) and installed packages

Usage

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)

Arguments

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 NULL to not include package versions in your requirements file.

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?

Details

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:

Matching will fail if:

Value

Nothing is returned. Results are written to output_path

Examples

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)

bmewing/requirements documentation built on Oct. 27, 2021, 10:36 p.m.