通过Shiny导出RMarkdown生成的PDF

时间:2019-06-14 12:40:52

标签: r markdown r-markdown

如何以与从ShinyApp生成PDF文件相同的方式生成Word文件?

我在rmarkdown:render函数中尝试了不同的参数类型,如下所述:

mkRmd <- function(outpath, 
                  presTitle) {
  # outpath <- paste0(getwd())
  # presTitle <- "NEW_LETTER"
  #Creating a string to write out to text .Rmd file
  rmdOutput <- paste0(
    '---
    title: "',
    presTitle,
    '"
    output: 
      pdf_document: default
    ---

    ```{r setup, include=FALSE}
    knitr::opts_chunk$set(echo = FALSE,
    out.width="90%")
    ```
    '
  )

  writeLines(rmdOutput, paste0(outpath,"/",presTitle,".Rmd"))
}
    filename = "NEW_LETTER.pdf",
    content = function(file) {
      mkRmd(paste0(getwd()),"NEW_LETTER")
      rmarkdown::render(paste0(getwd(),"/NEW_LETTER.Rmd"),
                        "pdf_document",
                        output_file=file,
                        envir = new.env(parent = globalenv()))
    }
  )

输出就像已经创建了输出。 但是我没有下载.html版本的下载文件

0 个答案:

没有答案