Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cache is rebuild when it should not be #1708

Closed
fountainer opened this issue Apr 28, 2019 · 3 comments
Closed

cache is rebuild when it should not be #1708

fountainer opened this issue Apr 28, 2019 · 3 comments
Labels
bug Bugs
Milestone

Comments

@fountainer
Copy link

A minimal example is as follows:

\documentclass{article}

<<setup, echo = FALSE>>=
knitr::opts_chunk$set(
  cache = TRUE,
  autodep = TRUE
)
@

\begin{document}
<<chunk1>>=
n <- 6
print(seq_len(n))
print(Sys.time())
@

<<chunk2>>=
n <- 10
print(seq_len(n))
print(Sys.time())
@

\end{document}

Run the code once, the results are cached. When I change the code in the first chunk, say n <- 10 and rerun the code, the chunk2 is also rebuild. I expect that the chunk2 will not be rebuild since it should not depend on the n in the first chunk.

Session information is:

R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.4

Locale: C

Package version:
  evaluate_0.13   glue_1.3.0      grDevices_3.5.2 graphics_3.5.2 
  highr_0.7       knitr_1.21      magrittr_1.5    markdown_0.9   
  methods_3.5.2   mime_0.6        stats_3.5.2     stringi_1.4.3  
  stringr_1.4.0   tools_3.5.2     utils_3.5.2     xfun_0.5       
  yaml_2.2.0  

I have posted the issue in stackoverflow.

@yihui yihui added this to the v1.23 milestone May 16, 2019
@yihui yihui closed this as completed in 4d6fc85 May 16, 2019
@yihui yihui added the bug Bugs label May 16, 2019
@yihui
Copy link
Owner

yihui commented May 16, 2019

I just posted a reply on StackOverflow. Thanks for the report!

@github-actions
Copy link

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2020
@yihui
Copy link
Owner

yihui commented Aug 27, 2021

Since #1898 has been merged, an alternative solution to this issue is cache.globals = FALSE.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bugs
Projects
None yet
Development

No branches or pull requests

2 participants