Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/81.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 - Fatal编程技术网

R 闪亮:根据单选按钮选择更新选择输入

R 闪亮:根据单选按钮选择更新选择输入,r,shiny,R,Shiny,我正在构建一个闪亮的应用程序,它有两个类。A类,a1类、b1类,类别为a2、b2的B类 我有一个带有“a类”和“B类”的单选按钮,根据选择,我想更新我的用户输入: library(collapsibleTree) library(shiny) library(Cairo) library(rsconnect) shinyUI(fluidPage( titlePanel("dsfs", align="center")), sidebarLayout( sidebarPanel( #update

我正在构建一个闪亮的应用程序,它有两个类。A类,a1类、b1类,类别为a2、b2的B类

我有一个带有“a类”和“B类”的单选按钮,根据选择,我想更新我的用户输入:

library(collapsibleTree)
library(shiny)
library(Cairo)
library(rsconnect)
shinyUI(fluidPage(
titlePanel("dsfs", align="center")),
sidebarLayout(
sidebarPanel(


#update selectInput based on it :
radioButtons(inputId = "buttons", "Selections", c("class A", "Class 
B"), 
selected = "Class A", inline = TRUE),


selectInput( "selection","Select a  Category ",choices = 
"",selected="")


),mainPanel(



diagonalNetworkOutput ("collapsiblenetwork")
)

))
)
server.r

    shinyServer(
    function(session,input,output){

output$collapsiblenetwork<-renderDiagonalNetwork({

if(input$buttons=="Class A"){
observeEvent( 
input$selection,updateSelectInput(session,"selection","Select a 
category ",choices = levels(class A$categories))
    )


user_input_value_superclass<-input$selection
    print(user_input_value_superclass)

# detection rate function :produces a  dataframe 
    classA_detect<- 
detecttion_rates(user_input_class_subclass_superclass = 
user_input_value_superclass,user_input_shiny_header ="Class A" )
    ClassA_superclass<-as.Node(ClassA_detect)    

    useRtreeList <- ToListExplicit(ClassA_superclass, unname = TRUE)
    network_plot<-diagonalNetwork( useRtreeList)


  }else if(input$buttons=="Class B") {


    observeEvent( 
   input$selection,updateSelectInput(session,"selection","Select a 
   category ",choices = levels(classB$categories))
    )

    user_input_value_subclass<-input$selection
   ClassB_detect<-detecttion_rates(user_input_class_subclass_superclass 
    = user_input_value_subclass,user_input_shiny_header = "Class B")

    ClassB_subclass<-as.Node(ClassB_detect)    

    useRtreeList <- ToListExplicit(ClassB_subclass, unname = TRUE)
    diagonalNetwork( useRtreeList)



  }   


})


})
shinyServer(
功能(会话、输入、输出){

output$CollapsbleNetwork我真的不想这么说,但是你的代码需要大量的修改。我很难理解你到底想做什么。一些一般性的建议:1.创建反应对象,比如
obj完全同意@Phil的评论;我还想补充一点,R是区分大小写的,所以你不能引用一个变量以不同的方式表示,如classA、classA等。此外,一个重要的建议是缩进代码,以便帮助您跟踪代码,理解语法错误(例如标题板中的语法错误)。