在Centos7/linux上使用Rmarkdown在pdf报告中包含绘图图

在Centos7/linux上使用Rmarkdown在pdf报告中包含绘图图,r,linux,pdf,r-markdown,plotly,R,Linux,Pdf,R Markdown,Plotly,我正在尝试在Centos7/linux服务器上使用R、Shiny和Rmarkdown创建一个pdf报告,其中包括使用kable生成的绘图和表格 我已经能够在Mac OS上成功生成pdf报告,但是,当我将代码移动到基于linux的服务器时,我遇到了通过web浏览器生成pdf报告的问题。我在下面列出了生成报告时收到的错误消息 我收到的相应错误是: 潘多克:找不到图像“/srv/shinny server/../figure latex/raw%20variant%20plot-1.pdf”,正在跳

我正在尝试在Centos7/linux服务器上使用R、Shiny和Rmarkdown创建一个pdf报告,其中包括使用kable生成的绘图和表格

我已经能够在Mac OS上成功生成pdf报告,但是,当我将代码移动到基于linux的服务器时,我遇到了通过web浏览器生成pdf报告的问题。我在下面列出了生成报告时收到的错误消息

我收到的相应错误是:


潘多克:找不到图像“/srv/shinny server/../figure latex/raw%20variant%20plot-1.pdf”,正在跳过

潘多克:找不到图像“/srv/shinny server/../figure latex/Variant%20Table-1.pdf”,正在跳过

pandoc:从TeX源生成PDF时出错

!!LaTeX错误:找不到文件'titling.sty'


我尝试了许多不同的解决方案来解决这个问题,包括将我的Latex postscript编辑器更新到最新版本Texlive2017(其中包含“titling.sty”,并测试它在linux服务器环境中启动时是否可以生成PDF)、从github存储库更新Rstudio/Rmarkdown、,将R更新为最新版本(3.3)和所有相关的R绘图/其他软件包

我怀疑问题在于Rmarkdown没有在linux环境中指向我的Texlive,因此它无法识别titling.sty包

我也尝试过使用Shiny提供的downloadHandler,但是遇到了类似的问题。任何指导都将不胜感激

我已将我的代码包括在下面:

服务器.R


generateReport
    generateReport <- observeEvent(input$genReportInput, {

    params <- list(runId = as.list(input$runInput),
            data_Specimen =  sumSpecimenTab(),
            rawdata_VariantPlotRun = runIdQMData(),
            rawdata_VariantPlotAll = allRunQMData())

        outputPath <- paste("qmPath/", Sys.Date(), "_QMrun_nsc", input$runInput, ".pdf", sep = "")


        rmarkdown::render("test_downloadQMReport.Rmd", output_dir = qmPath, output_file = paste(Sys.Date(), "_QMrun_nsc", input$runInput, ".pdf", sep = ""),
                  pdf_document(latex_engine = "pdflatex", latex_dependency("") ), params = params,envir = new.env(parent = globalenv()))
    })
---
output: pdf_document
always_allow_html: yes
params:
  data_Specimen: NA
  rawdata_VariantPlotRun: NA
  rawdata_VariantPlotAll: NA
---



```{r libraries, echo = FALSE}
library(plotly)
library(lazyeval)
library(tidyr)
library(reshape2)
library(plyr)
library(stringr)
library(dplyr)
library(ggplot2)
library(grid)
library(gridExtra)
library(knitr)
library(pander)
library(gtable)
```

```{r kable table, echo=FALSE}

kable(sumSpecimenTab <- tbl_df(params$data_Specimen))

```

```{r raw variant plot, plotly=TRUE, fig.height=9, fig.width=8, echo=FALSE}

runInputQMData <- tbl_df(params$rawdata_VariantPlotRun)
allRunQMdf <- tbl_df(params$rawdata_VariantPlotAll)
maxVF <- max(allRunQMdf$VF) + 0.1

ggplot(runInputQMData, aes(x=interaction(cDNAChange, GI), y=VF, color = GI, label = Rep)) + ylim(0,maxVF) + geom_point(shape=16, size=2) + labs(title= "")  + theme(plot.margin = unit(c(1,1,3.5,1), "cm")) + theme(axis.text.x = element_text(angle=70, hjust=1, size = 10), axis.title.x=element_blank(),axis.title.y=element_blank(), legend.position="none", text=element_text(size=12))

```