When conducting analyses, you make many choices that ideally, you document and justify. This function saves stored justifications to a file.

save_workspace(
  file = rock::opts$get("justificationFile"),
  encoding = rock::opts$get("encoding"),
  append = FALSE,
  preventOverwriting = rock::opts$get("preventOverwriting"),
  silent = rock::opts$get("silent")
)

Arguments

file

If specified, the file to export the justification to.

encoding

The encoding to use when writing the file.

append

Whether to append to the file, or replace its contents.

preventOverwriting

Whether to prevent overwriting an existing file.

silent

Whether to be silent or chatty.

Value

The result of a call to justifier::export_justification().

Examples

### Get path to example source
examplePath <-
  system.file("extdata", package="rock");

### Get a path to one example file
exampleFile <-
  file.path(examplePath, "example-1.rock");

### Load example source
loadedExample <- rock::load_source(exampleFile);

### Split a code into two codes, showing progress (the backticks are
### used to be able to specify a name that starts with an underscore)
recoded_source <-
  rock::recode_split(
    loadedExample,
    codes="childCode1",
    splitToCodes = list(
      `_and_` = " and ",
      `_book_` = "book",
      `_else_` = TRUE
    ),
    silent=FALSE,
    justification = "Because this seems like a good idea"
  );
#> Creating 3 source filters.
#> Splitting filtered/matching occurrences of code 'childCode1' into '_and_', '_book_' & '_else_'.
#> Using regular expression '(\[\[|>)childCode1(\]\]|>)'.
#> 
#> Out of the 132 utterances in the provided source, 8 match both the general filter and the split filter for '_and_' and have not yet been matched by a previous split filter. Of these, 2 have been coded with code 'childCode1' and will now be coded with code '_and_'.
#> --------PRE: Lorem Ipsum is simply dummy text of the printing and typesetting industry. [[parentCode1>childCode1]]
#>        POST: Lorem Ipsum is simply dummy text of the printing and typesetting industry. [[parentCode1>_and_]]
#> --------PRE: by accident, sometimes on purpose (injected humour and the like). [[parentCode1>childCode1>grandchildCode3]]
#>        POST: by accident, sometimes on purpose (injected humour and the like). [[parentCode1>_and_>grandchildCode3]]
#> 
#> Out of the 132 utterances in the provided source, 2 match both the general filter and the split filter for '_book_' and have not yet been matched by a previous split filter. Of these, 1 have been coded with code 'childCode1' and will now be coded with code '_book_'.
#> --------PRE: ~specimen book. [[parentCode1>childCode2]] [[childCode1]] [[intensity||2]]
#>        POST: ~specimen book. [[parentCode1>childCode2]] [[_book_]] [[intensity||2]]
#> 
#> Out of the 132 utterances in the provided source, 132 match both the general filter and the split filter for '_else_' and have not yet been matched by a previous split filter. Of these, 3 have been coded with code 'childCode1' and will now be coded with code '_else_'.
#> --------PRE: using 'Content here, content here', making it look like readable English. [[parentCode1>childCode1>grandchildCode1]]
#>        POST: using 'Content here, content here', making it look like readable English. [[parentCode1>_else_>grandchildCode1]]
#> --------PRE: ~still in their infancy. [[parentCode1>childCode1>grandchildCode2]]
#>        POST: ~still in their infancy. [[parentCode1>_else_>grandchildCode2]]
#> --------PRE: accompanied by English versions from the 1914 translation by H. Rackham. [[childCode1>grandchildCode2]]
#>        POST: accompanied by English versions from the 1914 translation by H. Rackham. [[_else_>grandchildCode2]]
#> 
#> Split 6 instances of code 'childCode1' into '_and_', '_book_' & '_else_'.
#> 
#> Saved decision and justification 'Because this seems like a good idea' using the {justifier} package.

### Save this workspace to a file
temporaryFilename <- tempfile();
rock::save_workspace(file = temporaryFilename);