Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/77.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
闪亮的R动作按钮控制反应元件_R_Shiny_Shiny Server - Fatal编程技术网

闪亮的R动作按钮控制反应元件

闪亮的R动作按钮控制反应元件,r,shiny,shiny-server,R,Shiny,Shiny Server,不确定我是否应该使用这个术语。基本上,我有一个反应式功能,显示用户上传的CSV文件,我想使用操作按钮启动绘图生成过程。此时,绘图始终是动态生成的。因此,我想知道,在renderPlot函数中,如何让操作按钮覆盖被动元素。谢谢 用户界面 服务器.R shinyServer(功能(输入、输出){ 数据输入在renderPlot()中使用isolate,这样它只会在启动input$go按钮时更新。如果这样做,当其他反应元素发生变化时,绘图将不会重新绘制,但input$go在isolate之外,因此它将

不确定我是否应该使用这个术语。基本上,我有一个反应式功能,显示用户上传的CSV文件,我想使用
操作按钮
启动绘图生成过程。此时,绘图始终是动态生成的。因此,我想知道,在
renderPlot
函数中,如何让
操作按钮
覆盖
被动
元素。谢谢

用户界面 服务器.R
shinyServer(功能(输入、输出){

数据输入在
renderPlot()
中使用
isolate
,这样它只会在启动
input$go
按钮时更新。如果这样做,当其他反应元素发生变化时,绘图将不会重新绘制,但
input$go
isolate
之外,因此它将导致绘图重新绘制

 output$Plot <- renderPlot({
    input$go
    isolate( 
        hist(dataInput()$data_load$Col3[study()$study_choose]) 
    )
  })
输出$Plot
shinyServer(function(input, output) {
  
  dataInput <- reactive({
    inFile <- input$file1
    if (is.null(inFile)) return(NULL)
    data_load<-subset(read.csv(inFile$datapath, header=T, sep=",", quote='"', stringsAsFactors=FALSE), select=input$show_vars)
    data_study<-unique(data_load$Col2)
    return (list("data_load"=data_load, "data_study"=data_study))
  })
 
  study <- reactive({
    all_citation<-dataInput()$data_load$Col2
    study_choose<-unlist(lapply(input$columns,  function(x) which(all_citation==x)))
    return (list("study_choose"=study_choose))
  })

  ##Generate the data table####
  output$contents <- renderDataTable({
    study_choose_temp<-study()$study_choose
    dataInput()$data_load[study_choose_temp,]
  })
  
  ###I would like the actionButton controls reactive elements 
  ###dataInput()$data_load$Col3[study()$study_choose]

  output$Plot <- renderPlot({
    input$go
    hist(dataInput()$data_load$Col3[study()$study_choose])
  })
  
  output$study <- renderUI({
    # If missing input, return to avoid error later in function
    if(is.null(dataInput()$data_study)) return()
    # Create the checkboxes and select them all by default
    checkboxGroupInput("columns", "Choose studies to plot", 
                       choices  = dataInput()$data_study,
                       selected = dataInput()$data_study)
    
  })
})
 output$Plot <- renderPlot({
    input$go
    isolate( 
        hist(dataInput()$data_load$Col3[study()$study_choose]) 
    )
  })