| orderly_cleanup | R Documentation |
Find, and delete, file that were generated by running a report.
Until you're comfortable with what this will do, you are strongly
recommended to run orderly_cleanup_status first to see what will
be deleted.
orderly_cleanup(name = NULL, dry_run = FALSE, root = NULL)
orderly_cleanup_status(name = NULL, root = NULL)
name |
Name of the report directory to clean (i.e., we look
at |
dry_run |
Logical, indicating if we should not delete anything, but instead just print information about what we would do |
root |
The path to the root directory, or |
After file deletion, we look through and remove all empty directories; orderly has similar semantics here to git where directories are never directly tracked.
For recent gert we will ask git if files are ignored; if ignored
then they are good candidates for deletion! We encourage you to
keep a per-report .gitignore that lists files that will copy
into the source directory, and then we can use that same
information to clean up these files after generation.
Importantly, even if a file matches an ignore rule but has been
committed to your repository, it will no longer match the ignore
rule.
An (currently unstable) object of class
orderly_cleanup_status within which the element delete
indicates files that would be deleted (for
orderly_cleanup_status) or that were deleted (for
orderly_cleanup)
In orderly1 this function has quite different semantics, because the full set of possible files is always knowable from the yaml file. So there, we start from the point of view of the list of files then compare that with the directory.
# Create a simple example:
path <- orderly_example()
# We simulate running a packet interactively by using 'source';
# you might have run this line-by-line, or with the "Source"
# button in Rstudio.
source(file.path(path, "src/data/data.R"), chdir = TRUE)
# Having run this, the output of the report is present in the
# source directory:
fs::dir_tree(path)
# We can detect what might want cleaning up by running
# "orderly_cleanup_status":
orderly_cleanup_status("data", root = path)
# Soon this will print more nicely to the screen, but for now you
# can see that the status of "data.rds" is "derived", which means
# that orderly knows that it is subject to being cleaned up; the
# "delete" element shows what will be deleted.
# Do the actual deletion:
orderly_cleanup("data", root = path)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.