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)
}
)
}
这是我的服务器。r代码。我已经创建了一个输入id为“click”的动作按钮来生成条形图,但是当我上传文件而不单击动作按钮时,会直接生成图形。我应该对代码进行哪些更改?我尝试使用eventReactive,但结果保持不变