Different results depending on using cache = TRUE vs FALSE

Hi, I used RMarkdown to write a paper. Frustratingly, I've noticed that results seem to change (when data/other things haven't changed), and when I ran RMarkdown to create two separate PDFs with knitr::opts_chunk$set(cache=TRUE) vs knitr::opts_chunk$set(cache=FALSE) the data is different. This doesn't make sense to me. I've also tried running Wickham's suggestion knitr::clean_cache(), but that doesn't seem to do much. It's not good have data turn out two different ways, and I'm wondering whether TRUE or FALSE is correct and why?

These are my header settings:

---
fig: no crop
geometry: left=1mm, right=1mm, top=1mm, bottom=1mm, asymmetric
indent: TRUE
output:
  pdf_document: default
  html_document:
    df_print: paged
    fig_caption: yes
    includes:
      in_header: my_header.tex
  word_document: default
header-includes: 
    - \usepackage{placeins}
    - \usepackage{indentfirst}
    - \usepackage{setspace}\doublespacing
    - \usepackage{lineno}
    - \linenumbers

    

---
```{r echo = FALSE, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
knitr::opts_chunk$set(dpi=300)
knitr::opts_chunk$set(warning=FALSE)
knitr::opts_chunk$set(messages=FALSE)
knitr::opts_chunk$set(fig.show="hold")
knitr::opts_chunk$set(strip.white=TRUE)
knitr::opts_chunk$set(autodep = TRUE)
knitr::opts_chunk$set(cache=TRUE)
knitr::opts_chunk$set(scientific=FALSE)
knitr::clean_cache()

scientific=FALSE
# knitr::clean_cache()
options(digits=3)

Thanks much!

James

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.