When conducting analyses, you make many choices that ideally, you document and justify. This function saves stored justifications to a file.
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_'.
#>
#> Warning: You specified a justification, but the `justifier` package isn't installed. You can install the most recent version using the `remotes` package with:
#>
#> remotes::install_gitlab('r-packages/justifier');
#>
#> You can also install the version on CRAN with:
#>
#> install.packages('rock');
### Save this workspace to a file
temporaryFilename <- tempfile();
rock::save_workspace(file = temporaryFilename);
#> Error in rock::save_workspace(file = temporaryFilename): You specified that you wanted to save your `justifier` workspace, but the `justifier` package isn't installed. You can install the most recent version using the `remotes` package with:
#>
#> remotes::install_gitlab('r-packages/justifier');
#>
#> You can also install the version on CRAN with:
#>
#> install.packages('rock');