freeze: Run an analysis while freezing a copy of the code (and...

Description Usage Arguments Value Examples

View source: R/freezr.R

Description

Run an analysis while freezing a copy of the code (and perhaps dependencies) for later perusal.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
freeze(
  analyses_to_run,
  prefix_omit = "scripts",
  destination,
  run_from_cryo_storage = FALSE,
  dependencies = NULL,
  seed_to_set = NULL,
  timestamp_as_folder = TRUE,
  force = FALSE,
  copy_deps_kb_limit = 100,
  purl_aggressively = TRUE,
  chastise = FALSE,
  notes_file = "notes.md",
  repos_to_track = NULL
)

Arguments

analyses_to_run

R or R markdown files to be run and frozen.

prefix_omit

freeze archives your code in a way that preserves folder structures, but if you want to omit a prefix, specify it here.

destination

Where to save the code (and log, and maybe dependencies and output)

run_from_cryo_storage

If FALSE (default), runs the code from the current working directory. If TRUE, runs from destination (or a folder within it – see param timestamp_as_folder). The default option, FALSE, makes it easier to write your code because you know where it'll be run from. You can access Sys.getenv()[["FREEZR_DESTINATION"]] within your scripts to produce custom output. The non-default option makes it easier to break code unless it uses absolute paths throughout.

dependencies

A list of file paths to extra files your analysis uses. They will get saved to destination if they are smaller than copy_deps_kb_limit.

seed_to_set

seed for rng. If NULL (default), seed doesn't get set.

timestamp_as_folder

If TRUE (default), one extra folder is added to destination based on the current time and date (down to the second). If FALSE, code gets saved to destination.

force

If FALSE, refuses to continue when destination is not empty. If TRUE, continues saving results even to non-empty destination. Default is FALSE.

copy_deps_kb_limit

dependencies get saved to destination if they are smaller than copy_deps_kb_limit.

purl_aggressively

If TRUE (default), then when purling Rmd files, the corresponding R files may be overwritten.

chastise

If TRUE (default), creates a notes.txt file for you and nags you about filling it.

notes_file

Name of file to be created while chastiseing.

repos_to_track

For git users. If you want to record what commit some outside repo is on – for example, a package that you are developing separate from your data analysis repo – put the path here. You can put more than one.

Value

returns destination arg.

Examples

1
2
3
#setwd( file.path( "~", "my_freezr_example_project" ), )
#freeze( analyses_to_run = c( "scripts/my_functions.Rmd", "scripts/my_script.R" ),
#        destination = file.path("~", "my_freezr_example_project", "results") )

ekernf01/freezr documentation built on Feb. 8, 2022, 5:22 a.m.