clean_cache: Clean cache files that are probably no longer needed

View source: R/cache.R

clean_cacheR Documentation

Clean cache files that are probably no longer needed

Description

If you remove or rename some cached code chunks, their original cache files will not be automatically cleaned. You can use this function to identify these possible files, and clean them if you are sure they are no longer needed.

Usage

clean_cache(clean = FALSE, path = opts_chunk$get("cache.path"))

Arguments

clean

Boolean; whether to remove the files.

path

Path to the cache.

Note

The identification is not guaranteed to be correct, especially when multiple documents share the same cache directory. You are recommended to call clean_cache(FALSE) and carefully check the list of files (if any) before you really delete them (clean_cache(TRUE)).

This function must be called within a code chunk in a source document, since it needs to know all chunk labels of the current document to determine which labels are no longer present, and delete cache corresponding to these labels.


yihui/knitr documentation built on Nov. 24, 2024, 5:10 a.m.