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