title: RMarkdown: Why do I have to reinstall all packages everytime I knit?
body: <p>I have the following R code in one of my RMarkdown scripts: </p>
  
  <pre><code>install.packages("dplyr", repos="http://cran.us.r-project.org")
  install.packages("tidyr", repos="http://cran.us.r-project.org")
  install.packages("ggplot2", repos="http://cran.us.r-project.org")
  library(dplyr)
  library(tidyr)
  library(ggplot2)
  library(scales)
  options(scipen = 999)
  source("classify.r")
  </code></pre>
  
  <p>When I "knit" the Markdown to HTML with Shift+Ctrl+K, the packages are successfully installed and loaded. However, when I re-knit it, the packages are installed from scratch, every time - although I already have them, and that takes a while. </p>
  
  <p>I am using RStudio. </p>
  
  <p>How can I circumvent this without having to comment the respective lines? </p>