Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7952709
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T02:56:28+00:00 2026-06-04T02:56:28+00:00

I understand that I can use the cache=TRUE option to cache an R code

  • 0

I understand that I can use the cache=TRUE option to cache an R code chunk using R Markdown with knitr. E.g., It might look something like this:

```{r longanalysis, cache=TRUE}
for (i in 1:5000) {
    lm((i+1)~i)
}
```

And I realise that If I wanted to disable the cache for that analysis that I could change the option to cache=FALSE in the code chunk. However, if I have many R code chunks with caching enabled, this would require a careful find and replace operation.

Question

  • Is there a way of temporarily setting cache=FALSE for an entire R Markdown document?

Comments

I’ve seen this example where the first line is. So I imagine this is a way of setting global setting, but I think local settings override global settings.

`r opts_chunk$set(fig.width=5, fig.height=5, fig.path='')`
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T02:56:29+00:00Added an answer on June 4, 2026 at 2:56 am

    It seems the default is set to FALSE and local chunk options override the global options but one thing you could do is set the global options to cache by default by adding this to the top of your document

    `r opts_chunk$set(cache=TRUE)`
    

    Then for the sections you don’t want cached ever you would explicitly set those sections to cache=FALSE.

    Then if you want to set the whole document to not cache anything you could change the global option to FALSE and rerun it.

    The problem is that if any of the chunk options are set to cache=TRUE then those will override the global setting and won’t be rerun if you set the global option to FALSE. So I think the only way to achieve what you want is to change the default to cache=TRUE, explicitly set chunks that you don’t want cached to have cache=FALSE, and then you can switch the global option to FALSE to do what you want when the time occurs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I understand that I can change a sql table using the follow sp: EXEC
I understand that this can be done at release using the maven-gpg-plugin. However, I
I understand that I can call ToString().IndexOf(...), but I don't want to create an
I understand that Git can be used without a central repository. However, I am
I understand that spring can manage your sessions for you, if configured like so:
I'm reading up about attributes and understand that they can be made to apply
Based on Please explain JSONP , I understand that JSONP can be used to
OK so now I can understand that SO's search system is primarily based around
what is the need for a read shared lock? I can understand that write
![enter image description here][1]On my two demo and screenshot, you can understand that so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.