KnitR R - SVG не отображается в Word (docx), но в PDF и HTML - PullRequest
0 голосов
/ 30 января 2020

Я использую R 3.6.2 вместе с RStudio (бесплатно). У меня установлен knitr 1.27 ...

Когда я пытаюсь запустить следующий код DEMO:

---
title: "test"
output:
  word_document: default
  html_document: default
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## R Markdown

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 cars}
summary(cars)
```

## Including Plots

You can also embed plots, for example:

```{r pressure, echo=FALSE}
plot(pressure)
```

Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.

, я получаю все файлы, но DOCX показывает разбитое изображение для команды plot.

Кто-нибудь имеет представление о том, что не так?

Вы можете просмотреть вывод здесь: https://cloud.kluthr.de/index.php/s/ltJRLhNRF181JRr

Вывод уценки:

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

  |....................                                                  |  29%
label: setup (with options) 
List of 1
 $ include: logi FALSE

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

  |........................................                              |  57%
label: cars


processing file: test20200129.Rmd
  |..................................................                    |  71%
  ordinary text without R code

  |............................................................          |  86%
label: pressure (with options) 
List of 1
 $ echo: logi FALSE

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


/usr/lib/rstudio-server/bin/pandoc/pandoc +RTS -K512m -RTS test20200129.utf8.md --to docx --from markdown+autolink_bare_uris+tex_math_single_backslash+smart --output test20200129.docx --highlight-style tango --lua-filter /opt/R-3.6.2/library/rmarkdown/rmd/lua/pagebreak.lua 
output file: test20200129.knit.md


Output created: test20200129.docx

Заранее спасибо! :)

РЕДАКТИРОВАТЬ:

> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.3 LTS

Matrix products: default
BLAS:   /opt/R-3.6.2/lib/libRblas.so
LAPACK: /opt/R-3.6.2/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C               LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8     LC_MONETARY=en_US.UTF-8   
 [6] LC_MESSAGES=en_US.UTF-8    LC_PAPER=en_US.UTF-8       LC_NAME=C                  LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_3.6.2  htmltools_0.4.0 tools_3.6.2     yaml_2.2.0      Rcpp_1.0.3      rmarkdown_2.1   knitr_1.27      xfun_0.12       digest_0.6.23   rlang_0.4.2    
[11] evaluate_0.14
...