r - Issue with creating PDf file with Pander+Knitr: Error when putting table with caption and plot directly next to each other -
i have reproducible error pander (+ knitr): when table caption , plot set straight each other, cannot create pdf file. utilize pander 0.5.1, knitr 1.7, r version 3.1.1, miktex + rstudio on windows.
so next produce error (see list of errors , non-errors below):
```{r, echo=false, eval=true} pander(cor(cars), caption="whatever" ) # or other captioned table hist(cars$speed) #or other plot ``` pandoc.exe: error producing pdf tex source fehler: pandoc document conversion failed error 43 zus�tzlich: warnmeldung: ausf�hrung von kommando '"c:/program files/rstudio/bin/pandoc/pandoc" teste_markdown_cor+hist.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output teste_markdown_cor+hist.pdf --template "c:\users\jbothe\documents\r\win-library\3.1\rmarkdown\rmd\latex\default.tex" --highlight-style tango --latex-engine pdflatex --variable "geometry:margin=1in"' ergab status 43 ausf�hrung angehalten
when manually copy&paste output pander, issue seems empty line before plot:
doesnt work:
-------------------------- speed dist ----------- ------- ------ **speed** 1 0.8069 **dist** 0.8069 1 -------------------------- table: k ```{r, echo=false, eval=false} hist(cars$speed) ```
works without error
-------------------------- speed dist ----------- ------- ------ **speed** 1 0.8069 **dist** 0.8069 1 -------------------------- table: k ```{r, echo=false, eval=false} hist(cars$speed) ```
but if set different empty lines in code-chunk between pander , plot, error continues
list:
--- title: "teste cor + hist" output: pdf_document --- # not work ```{r, echo=false} library(pander) ``` not work: ```{r, echo=false, eval=true} pander(cor(cars), caption="korrelationen" ) hist(cars$speed) ``` not work : ```{r, echo=false, eval=false} pander(cor(cars), caption="korrelationen" ) plot(cars) ``` not work: ```{r, echo=false, eval=false} pander(cor(cars), caption="k" ) plot(cars) ``` not work: ```{r, echo=false, result='asis', comment=na, eval=false} pander(cor(cars), caption="korrelationen" ) #several line breaks hist(cars$speed) ``` doesnt work: -------------------------- speed dist ----------- ------- ------ **speed** 1 0.8069 **dist** 0.8069 1 -------------------------- table: k ```{r, echo=false, eval=false} hist(cars$speed) ``` # works without error -------------------------- speed dist ----------- ------- ------ **speed** 1 0.8069 **dist** 0.8069 1 -------------------------- table: k ```{r, echo=false, eval=false} hist(cars$speed) ``` works: ```{r, echo=false, eval=true} cat("korrelationen") hist(cars$speed) ``` works: ```{r, echo=false, eval=true} pander(cor(cars), caption="korrelationen" ) cat("korrelationen") hist(cars$speed) ``` works: ```{r, echo=false, eval=true} cat("table: korrelationen") hist(cars$speed) ``` works: ```{r, echo=false, result='asis', comment=na, eval=true} pander(cor(cars), caption="korrelationen" ) cat("table: korrelationen") hist(cars$speed) ```
i found workaround manualy adding lineabreak @ end of caption. still think should considered bug?!?
works: ```{r, echo=false, eval=true} pander(cor(cars), caption="whatever text\n" ) hist(cars$speed) ```
r knitr pander
No comments:
Post a Comment