r Вяжите в pdf / html: преобразование документа pandoc завершилось ошибкой 2 - PullRequest
0 голосов
/ 07 сентября 2018

Кажется, что файл R Markdown работает в Rstudio. Файл r Markdown можно преобразовать в слово, но не в pdf / html. (Вчера это дало другую проблему, поэтому я изменил свой вопрос здесь.) Любая помощь будет оценена!

Это контекст моего файла Markdown:

---
title: "Test"
author: "Test"
date: "2018/9/8"
output: html_document
---
## R test

```{r test}
x<-rnorm(500)
y<-rnorm(x*10)
ls()
plot(x,y)
rm(x,y)
```

This is an test.

Это результат, который я вяжу в html:

 |......................                                           |  33%
  ordinary text without R code



processing file: test.Rmd
  |...........................................                      |  67%
label: test
  |.................................................................| 100%
  ordinary text without R code
/usr/local/bin/pandoc +RTS -K512m -RTS test.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rmarkdown/rmd/h/default.html --no-highlight --variable highlightjs=1 --variable 'theme:bootstrap' --include-in-header /var/folders/_h/013l11r91m3gny4lqwsvh5qh0000gn/T//Rtmpfvxqld/rmarkdown-str268664475eb.html --mathjax --variable 'mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML' 
output file: test.knit.md

--smart/-S has been removed.  Use +smart or -smart extension instead.
For example: pandoc -f markdown+smart -t markdown-smart.
Try pandoc --help for more information.
error: pandoc document conversion failed with error 2
stop processing

Это результат, если я вяжу в pdf:

|......................                                           |  33%
  ordinary text without R code

  |...........................................                      |  67%
label: test


processing file: test.Rmd
  |.................................................................| 100%
  ordinary text without R code

    /usr/local/bin/pandoc +RTS -K512m -RTS test.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output test.pdf --template /Library/Frameworks/R.framework/Versions/3.4/Resources/library/rmarkdown/rmd/latex/default-1.17.0.2.tex --highlight-style tango --latex-engine /Library/TeX/texbin/pdflatex --variable graphics=yes --variable 'geometry:margin=1in' 
    output file: test.knit.md

    --latex-engine has been removed.  Use --pdf-engine instead.
    Try pandoc --help for more information.
    error: pandoc document conversion failed with error 2
    stop processing

1 Ответ

0 голосов
/ 08 сентября 2018

Небольшой фон может помочь:

Pandoc - это двоичный файл на Haskell (то есть отдельная часть программного обеспечения, не принадлежащего R), который поставляется с RStudio для запуска преобразования RMarkdown. Кажется, вы получаете некоторые предупреждения об устаревании, например:

  • --latex-engine has been removed. Use --pdf-engine instead.
  • --smart/-S has been removed. Use +smart or -smart extension instead.

Это говорит о том, что вы, вероятно, имеете более старую версию RStudio, то есть более старую версию Pandoc. Вы можете переустановить RStudio, чтобы убедиться, что у вас есть соответствующая версия Pandoc, а затем отладить.

Также обязательно переустановите knitr и rmarkdown с новейшими версиями.

...