data.table::setDTthreads(2)
tmpDir <- file.path(tempdir(), "reproducible_examples", "clearStubArtifacts")
lapply(c(runif, rnorm), function(f) {
reproducible::Cache(f, 10, cachePath = tmpDir)
})
# clear out any stub artifacts
showCache(tmpDir)
file2Remove <- dir(CacheStorageDir(tmpDir), full.name = TRUE)[1]
file.remove(file2Remove)
showCache(tmpDir) # repository directory still thinks files are there
# run clearStubArtifacts
suppressWarnings(clearStubArtifacts(tmpDir))
showCache(tmpDir) # stubs are removed
# cleanup
clearCache(tmpDir, ask = FALSE)
unlink(tmpDir, recursive = TRUE)
Run the code above in your browser using DataLab