Removes all output files generated by scripts in the pipeline, including intermediate files. This provides a complete clean of generated artifacts. The pipeline can be regenerated by running run() again.
Examples
# Copy sample project to temp directory
temp_dir <- tempfile()
dir.create(temp_dir)
sample_proj <- system.file("extdata", "sample-project", package = "bakepipe")
file.copy(sample_proj, temp_dir, recursive = TRUE)
#> [1] TRUE
# Change to the sample project directory
old_wd <- getwd()
setwd(file.path(temp_dir, "sample-project"))
# Run the pipeline first to create output files
run(verbose = FALSE)
#> [1] "processed.csv" "summary.csv"
# Now clean up the generated files
removed_files <- clean()
#>
#> [CLEAN] Bakepipe Clean
#> Found 2 output files to remove
#> [RM] processed.csv
#> [RM] summary.csv
#>
#> [SUMMARY]
#> Removed 2 files
#>
print(removed_files)
#> [1] "processed.csv" "summary.csv"
# Restore working directory and clean up
setwd(old_wd)
unlink(temp_dir, recursive = TRUE)