【发布时间】:2016-05-16 17:38:33
【问题描述】:
我是 Shiny 的新手,如果这是微不足道的,请原谅......
我有一个 server() 函数可以输出多个图。这些图使用相同的代码块,并且每个都添加了一些自己的代码,如下所示:
shinyServer( function( input, output ){
output$plot1 <- renderPlot({
the block of the same code
some code specific to plot1
})
output$plot1 <- renderPlot({
The block of the same code
some code specific to plot2
})
我想避免重复“相同代码的块”。这必须在 renderPlot 函数中,因为它从 UI 函数中获取可变数据。
【问题讨论】: