Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/url/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Shiny 将闪亮应用程序保存为函数_Shiny - Fatal编程技术网

Shiny 将闪亮应用程序保存为函数

Shiny 将闪亮应用程序保存为函数,shiny,Shiny,我正在尝试构建一个小的闪亮应用程序,我想将其保存为函数(方法已解释) 虽然应用程序运行良好,但我面临一个奇怪的问题。我的应用程序渲染一个绘图(以及其他一些输出)。但是,打印并不总是在浏览器上渲染。有时,绘图显示在R Studio的输出窗格上。而且这种行为似乎是相当随机的(即,有时它能正确地在浏览器上显示绘图,而通常情况下,输出只是在R Studio上绘图) 我在下面给出了我的代码的一个非常简化的版本,保留了应用程序的关键元素和结构: sampleApp我以前遇到过类似的问题,当时全球环境中有些东

我正在尝试构建一个小的闪亮应用程序,我想将其保存为函数(方法已解释)

虽然应用程序运行良好,但我面临一个奇怪的问题。我的应用程序渲染一个绘图(以及其他一些输出)。但是,打印并不总是在浏览器上渲染。有时,绘图显示在R Studio的输出窗格上。而且这种行为似乎是相当随机的(即,有时它能正确地在浏览器上显示绘图,而通常情况下,输出只是在R Studio上绘图)

我在下面给出了我的代码的一个非常简化的版本,保留了应用程序的关键元素和结构:


sampleApp我以前遇到过类似的问题,当时全球环境中有些东西可能与闪亮的应用程序冲突。您可以为此尝试重新启动R会话,更好地保持全局环境相对干净。我以前遇到过类似的问题,因为全局环境可能与闪亮的应用程序发生冲突。您可以为此尝试重新启动R会话,并更好地保持全局环境相对干净。
require(shiny)
shinyApp(
ui = fluidPage(
  sidebarLayout(
    sidebarPanel(uiOutput("variables"),
                 selectInput........#add other input widgets

    mainPanel(plotOutput("plot_output"),
              dataTableOutput...#few other output

  )
), 
server = function(input, output) {

  funcA <- reactive({
  #Generates a formula expression basis user inputs
  })

  fun_plot <- reactive({
    #Generates a plot output, calls funcA in the process
  })


  event_output <- eventReactive(input$ActButton,{

   # I have an action button..The plot (and other output) gets updated
   # when the button is clicked..
  })

  output$plot_output <- renderPlot({

    event_output()$plot_output

  })

  # other render output functions      
  }
 )
}