When I try to use R Markdown (in R Studio) along with Leaflet I get an error and it fails. Here is a simple R Markdown script along with the error I am getting. I have tried everything I can think of including: reinstalling and updating the various packages, restarting R Studio, updating my R and R Studio, rebooting, creating a simplified script (e.g. the one below), etc.
NOTE: if I run the 2 lines R code in a regular R script, it displays the map with no errors so I know the problem is probably not with leaflet.
Thanks in advance for any ideas or suggestions.
---
title: "Untitled"
author: "David Wilkes"
date: "March 30, 2017"
output: html_document
---
This is an R Markdown test for leaflet
```{r}
library(leaflet)
leaflet() %>% addTiles %>% setView(lng = 5.0, lat = 51.0, zoom = 6)
```
pandoc.exe: Could not fetch E:\MYDOCU~1\R\R-33~1.3\library\leaflet\HTMLWI~1\lib\leaflet\#default#VML
E:\MYDOCU~1\R\R-33~1.3\library\leaflet\HTMLWI~1\lib\leaflet\: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 67
In addition: Warning message:
running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS slides_test.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output slides_test.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template "E:\MYDOCU~1\R\R-33~1.3\library\RMARKD~1\rmd\h\DEFAUL~1.HTM" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header "C:\Users\ya1dwil1\AppData\Local\Temp\RtmpQFfqPh\rmarkdown-str19f072517d2.html" --mathjax --variable "mathjax-url:https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"' had status 67
Execution halted
It's really a pain.
I had the same issue. I updated my Pandoc and R. Now, it's working. Here is my session info:
R version 3.4.3 (2017-11-30) Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Rcpp_0.12.14 knitr_1.18 magrittr_1.5
flexdashboard_0.5.1 xtable_1.8-2 lattice_0.20-35
R6_2.2.2
stringr_1.2.0 tools_3.4.3 grid_3.4.3
htmltools_0.3.6 leafletplugins_0.0.1 crosstalk_1.0.0
yaml_2.1.16
leaflet_1.1.0 rprojroot_1.3-2 digest_0.6.13
shiny_1.0.5 htmlwidgets_1.0 evaluate_0.10.1
mime_0.5
rmarkdown_1.8 stringi_1.1.6 compiler_3.4.3
backports_1.1.2 jsonlite_1.5 httpuv_1.3.5
Hope it helps.
Related
I'm trying to render and old rmarkdown file after I've updated R and RStudio, and all packages, but I'm getting:
Error: pandoc document conversion failed with error 99
However, the path is correct. I've rendered to HTML yesterday and everything worked fine.
```{r, echo=FALSE, fig.cap="", out.width = '50%', fig.align='center'}
knitr::include_graphics("/img/posts/que-es-un-api/mastercard-blockchain-api.jpg")
```
It says the path to the image is wrong, but hope you can see from
image path is right.
"C:/PROGRA~1/Pandoc/pandoc" +RTS -K512m -RTS que-es-un-api.utf8.md --to html4 --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash+smart --output que-es-un-api.html --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\OGONZALES\Documents\R\win-library\3.6\rmarkdown\rmd\h\default.html" --no-highlight --variable highlightjs=1 --variable "theme:bootstrap" --include-in-header "C:\Users\OGONZA~1\AppData\Local\Temp\RtmpSsSNeA\rmarkdown-str1340bc36ef.html" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"
File /img/posts/que-es-un-api/mastercard-blockchain-api.jpg not found in resource path
Error: pandoc document conversion failed with error 99
Execution halted
I've even tried to reinstall Pandoc with:
# installing/loading the package:
if(!require(installr)) { install.packages("installr"); require(installr)} #load / install+load installr
# Installing pandoc
install.pandoc()
sessionInfo:
R version 3.6.1 (2019-07-05)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17763)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.6.1 htmltools_0.3.6 tools_3.6.1 yaml_2.2.0 Rcpp_1.0.2
[6] rmarkdown_1.14 knitr_1.24 xfun_0.8 digest_0.6.20 evaluate_0.14
Maybe the working directory was changed. Try to include the whole path:
```{r, echo=FALSE, fig.cap="", out.width = '50%', fig.align='center'}
knitr::include_graphics("D:/omargonzalesdiaz/static/img/posts/que-es-un-api/mastercard-blockchain-api.jpg")
```
This issue is discussed here and here which is not a bug per se. The solution which worked for me is to use:
```{r example, echo = FALSE, out.width='80%', out.height='50%'}
knitr::include_graphics(paste0(getwd(), "/images/example_image.png"))
```
If you are working within an Rstudio project, it will help to specify the directory first:
```{r example, echo = FALSE, out.width='80%', out.height='50%'}
setwd(rprojroot::find_rstudio_root_file())
knitr::include_graphics(paste0(getwd(), "/images/example_image.png"))
```
See here and here.
When knitting to beamer_presentation I'm receiving this error message, does anyone know how to read it and solve this issue?
Code:
---
title: "Untitled"
author: "Author"
date: "6 April 2018"
output: beamer_presentation
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
```
## R Markdown
Something
Error message:
processing file: TEST.Rmd
|...................... | 33%
ordinary text without R code
|........................................... | 67%
label: setup (with options)
List of 1
$ include: logi FALSE
|.................................................................| 100%
ordinary text without R code
output file: TEST.knit.md
"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS TEST.utf8.md --to beamer --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output TEST.tex --highlight-style tango --latex-engine pdflatex --self-contained
Output created: TEST.pdf
Error in tools::file_path_as_absolute(output_file) :
file 'TEST.pdf' does not exist
Calls: <Anonymous> -> <Anonymous>
In addition: Warning message:
running command '"pdflatex" -halt-on-error -interaction=batchmode "TEST.tex"' had status 1
Execution halted
Version infos:
> sessionInfo()
R version 3.4.4 (2018-03-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
Matrix products: default
locale:
[1] LC_COLLATE=German_Switzerland.1252 LC_CTYPE=German_Switzerland.1252
[3] LC_MONETARY=German_Switzerland.1252 LC_NUMERIC=C
[5] LC_TIME=German_Switzerland.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_0.12.16 tufte_0.3 digest_0.6.15 withr_2.1.2 rprojroot_1.3-2
[6] R6_2.2.2 backports_1.1.2 git2r_0.21.0 magrittr_1.5 evaluate_0.10.1
[11] httr_1.3.1 stringi_1.1.7 curl_3.2 rmarkdown_1.9.8 devtools_1.13.5
[16] tools_3.4.4 stringr_1.3.0 rsconnect_0.8.8 yaml_2.1.18 compiler_3.4.4
[21] memoise_1.1.0 htmltools_0.3.6 knitr_1.20
Note: A few months ago this worked without problems.
According to the GitHub issue rstudio/rmarkdown#1285, there are two solutions.
1st downgrade rmarkdown
devtools::install_version("rmarkdown", version = "1.8",
repos = "http://cran.us.r-project.org")
or
2nd install/upgrade tinytex
install.packages('rmarkdown') # installs v 1.9 at the moment
devtools::install_github('yihui/tinytex')
I chose the 2nd option, works fine for me.
I've been creating PDF reports via RMarkdown for a couple months now, but after installing MikTex, R and the rmarkdown and tidyverse packages on a new machine today, I received the following error message when attemping to knit a PDF:
"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS Test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.pdf --template "C:\Users\drewm\Documents\R\win-library\3.4\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --latex-engine xelatex --variable graphics=yes --variable "geometry:margin=1in"
! Undefined control sequence.
<argument> \LaTeX3 error:
Erroneous variable \c__fontspec_shape_n_n_tl used!
l.3806 \emfontdeclare{ \emshape, \eminnershape }
pandoc.exe: Error producing PDF
Error: pandoc document conversion failed with error 43
In addition: Warning message:
running command '"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS Test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.pdf --template "C:\Users\drewm\Documents\R\win-library\3.4\rmarkdown\rmd\latex\default-1.17.0.2.tex" --highlight-style tango --latex-engine xelatex --variable graphics=yes --variable "geometry:margin=1in"' had status 43
I was able to recreate the error with the simple example below:
Test.R
library(rmarkdown)
library(knitr)
setwd(C:/something)
render("Test.rmd", output_format=pdf_document(latex_engine="xelatex"), output_file="test.pdf")
Test.Rmd
---
title: "Habits"
output:
pdf_document:
latex_engine: xelatex
---
Hello World!
I also see the error when I knit Test.Rmd directly in RStudio instead of using a separate .R file with render(). I also tried using the lualatex pdf engine and received the same error as above. I am able to generate PDFs using the RMarkdown PDF example built into RStudio.
This post on Sourceforge seems relevant, but not useful since the solution was to update the fontspec package and I'm already using an updated fontspec package.
Session Info
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 15063)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] knitr_1.17 rmarkdown_1.6
loaded via a namespace (and not attached):
[1] compiler_3.4.1 backports_1.1.0 magrittr_1.5 rprojroot_1.2
[5] tools_3.4.1 htmltools_0.3.6 yaml_2.1.14 Rcpp_0.12.12
[9] stringi_1.1.5 stringr_1.2.0 digest_0.6.12 evaluate_0.10.1
Any help or advice is greatly appreciated!
The uninstall/reinstall of MikTex reverted several of the packages to outdated versions (it would be helpful if the MikTex installer prompted the user to update packages after installation). In this case, my fontspec package was reverted to 2.6a (see potential issue outlined in Sourceforge link above). After running MikTex Update to update all my installed packages. I was able to successfully produce the PDF output desired.
Even with a very simple Rmd-file generated by 'Newfile' -> 'New R Markdown' sequence selecting 'Document ' and 'PDF' as the Default Output Format I get the following error when pressing the 'Knit PDF' button in RStudio:
"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS mist2.utf8.md --to latex
--from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures
--output mist2.pdf --template "D:\_Dateien_von_ulk\Dokumente\R\win-library\3.2\rmarkdown\rmd\latex\default-1.14.tex" --highlight-style tango
--latex-engine pdflatex --natbib --variable graphics=yes --variable "geometry:margin=1in"
output file: mist2.knit.md
! Incomplete \iffalse; all text was ignored after line 131.
<inserted text>
\fi
<*> ./tex2pdf.2196/input.tex
! ==> Fatal error occurred, no output PDF file produced!
Transcript written on D:/ulk/uk-uni/Uni-ab-September-1999/Lehre/Unterlagen-Lehr
e-WS-2015-16/Lektuerekurs.VAR.ECM.COINT.WS2015.16/Pfaff.2008.RCode/RCode/tex2pd
f.2196/input.log.
pandoc.exe: Error producing PDF from TeX source
Fehler: pandoc document conversion failed with error 43
Zusätzlich: Warnmeldung:
Ausführung von Kommando '"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS mist2.utf8.md --to latex
--from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output mist2.pdf
--template "D:\_Dateien_von_ulk\Dokumente\R\win-library\3.2\rmarkdown\rmd\latex\default-1.14.tex"
--highlight-style tango --latex-engine pdflatex --natbib --variable graphics=yes
--variable "geometry:margin=1in"' ergab Status 43
Ausführung angehalten
The R session info provided by sessionInfo() gives:
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252 LC_MONETARY=German_Germany.1252
[4] LC_NUMERIC=C LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] RevoUtilsMath_3.2.2
loaded via a namespace (and not attached):
[1] htmltools_0.2.6 tools_3.2.2 yaml_2.1.13 rmarkdown_0.8.2 digest_0.6.8
Under Window 8.1. I use:
MikTeX version 2.9.5721
Pandoc 1.15.1.1.
RStudio 0.99.489
All libraries have been updated today (17th Nov 2015). Furthermore all software has been installed using admin rights in the installation default pathes on drive C: and has been made available to all user.
Knitr the Rmd file into HTML and Word works without any problems.
Any suggestion how to solve the problem?
Just encountered the same problem. Here's what happens:
---
date: "8. Mai 2017"
---
is treated as enumeration by pandoc. TeX then finds an enumeration inside \date{}:
\date{\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\setcounter{enumi}{7}
\tightlist
\item
Mai 2017
\end{enumerate}}
which it doesn't like at all.
Workarounds:
escape the dot: date: 8\. Mai or date: '8\. Mai 2017' or date: "8\\. Mai 2017" or
date: '`r format(Sys.time(), "%d\\. %B %Y")`'
the treatment as enumeration is triggered by the sequence number-dot-space. The problem does not occur with 08.05.2017 (nor with the slightly mistyped 8.Mai 2017).
I am using rmarkdown in Rstudio to try to Knit a PDF using the example code provided by Rstudio (code below):
---
title: "Untitled"
output:
pdf_document:
keep_tex: yes
---
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 <http://rmarkdown.rstudio.com>.
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)
```
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.
But, I get the following error:
! pdfTeX error (font expansion): auto expansion is only possible with scalable
fonts.
\AtBegShi#Output ...ipout \box \AtBeginShipoutBox
\fi \fi
l.144 \end{document}
pandoc.exe: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43
In addition: Warning message:
running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS test_rmarkdown.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output test_rmarkdown.pdf --template "C:\Users\XXXX\Documents\R\win-library\3.2\rmarkdown\rmd\latex\default.tex" --highlight-style tango --latex-engine pdflatex --variable "geometry:margin=1in"' had status 43 Execution halted
My session info is shown below:
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] Rcpp_0.11.6 digest_0.6.8 MASS_7.3-43 grid_3.2.2 plyr_1.8.2 gtable_0.1.2 magrittr_1.5 scales_0.2.4
[9] ggplot2_1.0.1 stringi_0.4-1 reshape2_1.4.1 rmarkdown_0.8 proto_0.3-10 tools_3.2.2 stringr_1.0.0 munsell_0.4.2
[17] yaml_2.1.13 colorspace_1.2-6 htmltools_0.2.6
And I am running the complete TeXworks version 0.4.6 64-bit.
I had similar problems before.
Try to run devtools::install_github("rstudio/rmarkdown")
This worked for me.
If you dont have devtools you need to run this to:
install.packages("devtools")
library(devtools).