【问题标题】:shinyFileSave does not save plotsshinyFileSave 不保存绘图
【发布时间】:2019-04-10 11:08:10
【问题描述】:

我正在尝试将闪亮应用程序的生成图保存到服务器端,即使我让它适用于数据帧,它也不适用于图。这是生成绘图但不将绘图保存到服务器端的代码的 sn-p。

这是ui.R上的代码

shinySaveButton(id = 'downloadplot1', label =  'Save plot', title = "Save plot as...", filetype = "png")

这是server.R脚本中的相关代码

observe({
    volumes <- c("wd"="/Users/upendra_35/Documents/CyVerse/Images_apps/DE/VICE/Ballgown_shinyapp/")
    shinyFileSave(input, "downloadplot1", roots=volumes, session=session)
    fileinfo <- parseSavePath(volumes, input$downloadplot1)
    if (nrow(fileinfo) > 0) {
      plotMeans(gene=input$gv_var_input, gown=bg1(), as.character(fileinfo$datapath))
    }
  })

如果您需要查看整个代码,请告诉我。

【问题讨论】:

    标签: r shiny shinydashboard


    【解决方案1】:

    没关系。我想到了。这是它的工作原理..

    observe({
        volumes <- c("wd"="/Users/upendra_35/Documents/CyVerse/Images_apps/DE/VICE/Ballgown_shinyapp/")
        shinyFileSave(input, "downloadplot1", roots=volumes, session=session)
        fileinfo <- parseSavePath(volumes, input$downloadplot1)
        if (nrow(fileinfo) > 0) {
          ggsave(plotMeans(gene=input$gv_var_input, gown=bg1()), filename = as.character(fileinfo$datapath))
        }
      })
    

    【讨论】:

      猜你喜欢
      • 2012-09-13
      • 2013-03-17
      • 2018-04-23
      • 2022-10-01
      • 1970-01-01
      • 1970-01-01
      • 2011-08-14
      • 2013-12-06
      • 1970-01-01
      相关资源
      最近更新 更多