闪亮的服务器和闪亮的应用程序

Shiny server and shiny apps

server <- function (input , output  )
{
    output$bar_plot <- renderPlot( 
        {   
            input$click
            inFile <- input$file1
            if (is.null(inFile))
               return(NULL)
            mydata <- read.csv(inFile$datapath)
            resources <-  factor (mydata$Resource.Name)
            stan <-  tapply (mydata$Standard.Hours,resources, sum , na.rm=TRUE)
            bil <-  tapply (mydata$Billable.Hours,resources, sum , na.rm=TRUE)
            bu <- bil*100 / stan
            mp <- barplot (bu,col=colors(27),las=2,yaxt="n",ylim=c(0,200),main="Billable      Utilization India-DSI")
            bu<- round(bu,2)
            text(mp, bu,labels=bu, pos = 3)
        }
    )
}

这是我的 server.r code.I 创建了一个带有输入 ID "click" 的操作按钮来生成条形图,但是一旦我上传文件而不点击操作 "click" 就直接生成图表 button.What 我应该修改代码吗?我尝试使用 eventReactive 但结果保持不变

你应该使用

shiny server <- function (input, output)
{
  plot <- eventReactive (input $click,
    {
       [code to develop plot]
    }
  )

output$bar_plot <- renderPlot ({ plot () })
}