Rmd动态生成用于导线测量的截面

Rmd动态生成用于导线测量的截面,r,shiny,r-markdown,R,Shiny,R Markdown,我知道这个问题在进来之前已经解决了。对不起,请再说一遍 关于Rmd的另一个问题。我想动态生成一个Rmd报告程序 library(shiny) shinyApp( ui = fluidPage( #sliderInput("slider", "Slider", 1, 100, 50), textInput("s1", "Description 1", "COG_Classify_BY7_b

我知道这个问题在进来之前已经解决了。对不起,请再说一遍

关于Rmd的另一个问题。我想动态生成一个Rmd报告程序

library(shiny)
shinyApp(
  ui = fluidPage(
    #sliderInput("slider", "Slider", 1, 100, 50),
    textInput("s1", "Description 1", "COG_Classify_BY7_bvsKY7_b_All_Cog.png"),
    textInput("s2", "Description 2", "COG_Classify_BY7_svsKY7_s_All_Cog.png"),
    downloadButton("report", "Generate report")
  ),
  server = function(input, output) {
    output$report <- downloadHandler(
      # For PDF output, change this to "report.pdf"
      filename = "report.html",
      content = function(file) {
        # Copy the report file to a temporary directory before processing it, in
        # case we don't have write permissions to the current working dir (which
        # can happen when deployed).
        tempReport <- file.path(tempdir(), "volcano2.Rmd")
        file.copy("volcano2.Rmd", tempReport, overwrite = TRUE)
        
        # Set up parameters to pass to Rmd document
        params <- list(tag = c("COG_Classify_BY7_bvsKY7_b_All_Cog.png", "COG_Classify_BY7_svsKY7_s_All_Cog.png"))
        
        # Knit the document, passing in the `params` list, and eval it in a
        # child of the global environment (this isolates the code in the document
        # from the code in this app).
        rmarkdown::render(tempReport, output_file = file,
                          params = params,
                          envir = new.env(parent = globalenv())
        )
      }
    )
  }
)
库(闪亮)
shinyApp(
ui=fluidPage(
#sliderInput(“滑块”,“滑块”,1100,50),
textInput(“s1”、“说明1”、“COG_按7_bvsKY7_b_All_COG.png分类”),
textInput(“s2”、“说明2”、“COG\u分类\u按7\u svsKY7\u s\u All\u COG.png”),
下载按钮(“报告”、“生成报告”)
),
服务器=功能(输入、输出){

输出$报告我知道问题在重复之前已经讨论过了
---
title: <center>volcano</center>
author: <center>`r knitr::opts_chunk$set(echo = FALSE, out.width="30%")``r knitr::include_graphics(paste("G:\\Project\\workspace","www\\logo.jpg",sep="\\"))`</center>
date: <center>Date:`r format(Sys.Date(),'%Y-%m-%d')`</center>
runtime: "static"
params:
  tag: NA
output:
  html_document:
    toc: no 
    toc_float: yes 
    keep_md: true
    theme: flatly
    number_sections: false
---

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



```{r, grouping_loop, results='asis', out.width='60%'}
n <- params$tag
for (i in n){
  a <- paste(tempdir(),i,sep = "\\")
  cat('\n')
  cat("#### " ,i, "\n\n")
  #print(a)
  cat(knitr::include_graphics(a,auto_pdf = F))
  cat('\n\n')
} ```