title: R markdown presentation not displaying plots
body: <p>I have Rstudio on Windows (<code>sessionInfo()</code> below) and am trying to build an r presentation using markdown.  When I try to knit HTML or PDF it does not seem to be retaining the folder where plots should be generated from and as a result my presentations are missing plots.  I have confirmed that it does work with a basic html_document though.</p>
  
  <p><strong>Does anyone have any ideas on how to resolve?</strong></p>
  
  <p><strong>MWE</strong> (rstudio default with headers for slides)</p>
  
  <pre><code>---
  title: "plottest2"
  author: "AN Other"
  date: "Monday, June 30, 2014"
  output: html_document
  ---
  ## Area 1 ##
  This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see &lt;http://rmarkdown.rstudio.com&gt;.
  
  When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
  
  ```{r}
  summary(cars)
  ```
  
  ## Area 2 ##
  You can also embed plots, for example:
  
  ```{r, echo=FALSE}
  plot(cars)
  ```
  
  Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
  </code></pre>
  
  <p><strong>This generates using the knit html command, but change html_document to ioslides_presentation and it won't pick up the plot</strong></p>
  
  <p><img src="https://i.stack.imgur.com/Fvyha.png" alt="Rstudio plot issue"></p>
  
  <p><strong>SessionInfo</strong></p>
  
  <pre><code>&gt; sessionInfo()
  R version 3.1.0 (2014-04-10)
  Platform: x86_64-w64-mingw32/x64 (64-bit)
  
  locale:
  [1] LC_COLLATE=English_United Kingdom.1252  LC_CTYPE=English_United Kingdom.1252    LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C                           
  [5] LC_TIME=English_United Kingdom.1252    
  
  attached base packages:
  [1] stats     graphics  grDevices utils     datasets  methods   base     
  
  other attached packages:
  [1] lattice_0.20-29 ggplot2_1.0.0  
  
  loaded via a namespace (and not attached):
   [1] colorspace_1.2-4 digest_0.6.4     evaluate_0.5.5   formatR_0.10     grid_3.1.0       gtable_0.1.2     htmltools_0.2.4  knitr_1.6        labeling_0.2     MASS_7.3-31     
  [11] munsell_0.4.2    plyr_1.8.1       proto_0.3-10     Rcpp_0.11.2      reshape2_1.4     rmarkdown_0.2.49 scales_0.2.4     stringr_0.6.2    tools_3.1.0      yaml_2.1.13
  </code></pre>
  
  <p>C:\Program Files\R\R-3.1.0\library\base\R.Rprofile</p>
  
  <pre><code>### This is the system Rprofile file. It is always run on startup.
  ### Additional commands can be placed in site or user Rprofile files
  #
  #  Copyright (C) 1995-2012 The R Core Team
  ### (see ?Rprofile).
  
  ### Notice that it is a bad idea to use this file as a template for
  ### personal startup files, since things will be executed twice and in
  ### the wrong environment (user profiles are run in .GlobalEnv).
  
  .GlobalEnv &lt;- globalenv()
  attach(NULL, name = "Autoloads")
  .AutoloadEnv &lt;- as.environment(2)
  assign(".Autoloaded", NULL, envir = .AutoloadEnv)
  T &lt;- TRUE
  F &lt;- FALSE
  R.version &lt;- structure(R.Version(), class = "simple.list")
  version &lt;- R.version            # for S compatibility
  
  ## for backwards compatibility only
  R.version.string &lt;- R.version$version.string
  
  ## NOTA BENE: options() for non-base package functionality are in places like
  ##            --------- ../utils/R/zzz.R
  
  options(keep.source = interactive())
  options(warn = 0)
  # options(repos = c(CRAN="@CRAN@"))
  # options(BIOC = "http://www.bioconductor.org")
  
  options(timeout = 60)
  options(encoding = "native.enc")
  options(show.error.messages = TRUE)
  ## keep in sync with PrintDefaults() in  ../../main/print.c :
  options(scipen = 0)
  options(max.print = 99999)# max. #{entries} in internal printMatrix()
  options(add.smooth = TRUE)# currently only used in 'plot.lm'
  options(stringsAsFactors = TRUE)
  if(!interactive() &amp;&amp; is.null(getOption("showErrorCalls")))
      options(showErrorCalls = TRUE)
  
  local({dp &lt;- Sys.getenv("R_DEFAULT_PACKAGES")
         if(identical(dp, "")) # marginally faster to do methods last
             dp &lt;- c("datasets", "utils", "grDevices", "graphics",
                     "stats", "methods")
         else if(identical(dp, "NULL")) dp &lt;- character(0)
         else dp &lt;- strsplit(dp, ",")[[1]]
         dp &lt;- sub("[[:blank:]]*([[:alnum:]]+)", "\\1", dp) # strip whitespace
         options(defaultPackages = dp)
      })
  
  ## Expand R_LIBS_* environment variables.
  Sys.setenv(R_LIBS_SITE =
             .expand_R_libs_env_var(Sys.getenv("R_LIBS_SITE")))
  Sys.setenv(R_LIBS_USER =
             .expand_R_libs_env_var(Sys.getenv("R_LIBS_USER")))
  
  .First.sys &lt;- function()
  {
      for(pkg in getOption("defaultPackages")) {
          res &lt;- require(pkg, quietly = TRUE, warn.conflicts = FALSE,
                         character.only = TRUE)
          if(!res)
              warning(gettextf('package %s in options("defaultPackages") was not found', sQuote(pkg)),
                      call.=FALSE, domain = NA)
      }
  }
  
  .OptRequireMethods &lt;- function()
  {
        if("methods" %in% getOption("defaultPackages")) {
          res &lt;- require("methods", quietly = TRUE, warn.conflicts = FALSE,
                         character.only = TRUE)
          if(!res)
              warning('package "methods" in options("defaultPackages") was not found', call.=FALSE)
      }
  }
  
  if(nzchar(Sys.getenv("R_BATCH"))) {
      .Last.sys &lt;- function()
      {
          cat("&gt; proc.time()\n")
          print(proc.time())
      }
      ## avoid passing on to spawned R processes
      ## A system has been reported without Sys.unsetenv, so try this
      try(Sys.setenv(R_BATCH=""))
  }
  ###-*- R -*-
  
  ## this will break if R is on a network share
  .Library &lt;- file.path(chartr("\\", "/", R.home()), "library")
  .Library.site &lt;- Sys.getenv("R_LIBS_SITE")
  .Library.site &lt;- if(!nchar(.Library.site)) file.path(R.home(), "site-library") else unlist(strsplit(.Library.site, ";"))
  .Library.site &lt;- .Library.site[file.exists(.Library.site)]
  
  if(!nzchar(Sys.getenv("R_LIBS_USER")))
      Sys.setenv(R_LIBS_USER=
                 file.path(Sys.getenv("R_USER"), "R",
                           "win-library",
                           paste(R.version$major,
                                 sub("\\..*$", "", R.version$minor),
                                 sep=".")
                           ))
  
  invisible(.libPaths(c(unlist(strsplit(Sys.getenv("R_LIBS"), ";")),
                        unlist(strsplit(Sys.getenv("R_LIBS_USER"), ";"))
                        )))
  
  local({
      popath &lt;- Sys.getenv("R_TRANSLATIONS", "")
      if(!nzchar(popath)) {
          paths &lt;- file.path(.libPaths(), "translations", "DESCRIPTION")
          popath &lt;- dirname(paths[file.exists(paths)][1])
      }
      bindtextdomain("R", popath)
      bindtextdomain("R-base", popath)
      bindtextdomain("RGui", popath)
      assign(".popath", popath, .BaseNamespaceEnv)
  })
  
  if(nzchar(Sys.getenv("R_PAPERSIZE"))) {
      options(papersize = Sys.getenv("R_PAPERSIZE"))
  } else {
      if(grepl("(canada|united.states)", Sys.getlocale("LC_MONETARY"),
               ignore.case = TRUE)) options(papersize = "letter")
      else options(papersize = "a4")
  }
  
  options(pager = if(length(grep("--ess", commandArgs()))) "console" else "internal",
          useFancyQuotes = (.Platform$GUI == "Rgui"),
          pdfviewer = Sys.getenv("R_PDFVIEWER", file.path(R.home("bin"), "open.exe")))
  
  if(.Platform$GUI == "Rgui")
      Sys.setenv(GFORTRAN_STDOUT_UNIT = "-1", GFORTRAN_STDERR_UNIT = "-1")
  
  local({
      br &lt;- Sys.getenv("R_BROWSER", NA_character_)
      if(!is.na(br)) options(browser = br)
      tests_startup &lt;- Sys.getenv("R_TESTS")
      if(nzchar(tests_startup)) source(tests_startup)
  })
  </code></pre>
  
  <p>C:\Program Files\R\R-3.1.0\etc\Rprofile.site</p>
  
  <pre><code># Things you might want to change
  
  # options(papersize="a4")
  # options(editor="notepad")
  # options(pager="internal")
  
  # set the default help type
  # options(help_type="text")
    options(help_type="html")
  
  # set a site library
  # .Library.site &lt;- file.path(chartr("\\", "/", R.home()), "site-library")
  
  # set a CRAN mirror
  # local({r &lt;- getOption("repos")
  #       r["CRAN"] &lt;- "http://my.local.cran"
  #       options(repos=r)})
  
  # Give a fortune cookie, but only to interactive sessions
  # (This would need the fortunes package to be installed.)
  #  if (interactive()) 
  #    fortunes::fortune()
  </code></pre>