Skip to content
Back to formatted view

Raw Message

Message-ID: <OFE37F0A6B.835B65D9-ONC1258139.003D3941-C1258139.003DE23D@lotus.hawesko.de>
Date: 2017-06-08T11:15:55Z
From: G.Maubach at weinwolf.de
Subject: Paths in knitr

Hi All,

I have to compile a report for the management and decided to use RMarkdown 
and knitr. I compiled all needed plots (using separate R scripts) before 
compiling the report, thus all plots reside in my graphics directory. The 
RMarkdown report needs to access these files. I have defined

```{r setup, include = FALSE}
knitr::opts_knit$set(
  echo = FALSE,
  xtable.type = "html",
  base.dir = "H:/2017/Analysen/Kundenzufriedenheit/Auswertung",
  root_dir = "H:/2017/Analysen/Kundenzufriedenheit/Auswertung",
  fig.path = "results/graphics")  # relative path required, see 
http://yihui.name/knitr/options
```

and then referenced my plot using

<img src = "email_distribution_pie.png"></img>

because I want to be able to customize the plotting attributes.

But that fails with the message "pandoc.exe: Could not fetch 
email_distribution_pie.png".

If I give it the absolute path 
"H:/2017/Analysen/Kundenzufriedenheit/Auswertung/results/graphics/email_distribution_pie.png" 
it works fine as well if I copy the plot into the directory where the 
report.RMD file resides. 

How can I tell knitr to fetch the ready-made plots from the graphics 
directory?

Kind regards

Georg