avoid error (#1504)
Co-authored-by: Mine Cetinkaya-Rundel <cetinkaya.mine@gmail.com>
This commit is contained in:
parent
75818986ca
commit
4fc2e09a10
|
@ -637,12 +637,12 @@ Knitr will update the results for the cached chunk whenever it detects that one
|
|||
Note that the chunks won't update if `a_very_large_file.csv` changes, because knitr caching only tracks changes within the `.qmd` file.
|
||||
If you want to also track changes to that file you can use the `cache.extra` option.
|
||||
This is an arbitrary R expression that will invalidate the cache whenever it changes.
|
||||
A good function to use is `file.info()`: it returns a bunch of information about the file including when it was last modified.
|
||||
A good function to use is `file.mtime()`: it returns when it was last modified.
|
||||
Then you can write:
|
||||
|
||||
``` {{r}}
|
||||
#| label: raw-data
|
||||
#| cache.extra: file.info("a_very_large_file.csv")
|
||||
#| cache.extra: !expr file.mtime("a_very_large_file.csv")
|
||||
|
||||
rawdata <- readr::read_csv("a_very_large_file.csv")
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue