如何在selectInput上选择不同的值

如何在selectInput上选择不同的值,select,input,shiny,Select,Input,Shiny,我想将我的csv数据引入这个应用程序,这个应用程序附在这个问题之后:我的目标是确保无论用户选择什么,这两个select输入都加载了不同的值!我的代码的问题是,第一个selectInput被阻止为相同的初始值,而它必须更改并防止第二个每次都有其值 ui <- fluidPage( fileInput('file1', 'Upload your CSV File'), htmlOutput("variables"), htmlOutput("facteurs"),

我想将我的csv数据引入这个应用程序,这个应用程序附在这个问题之后:我的目标是确保无论用户选择什么,这两个select输入都加载了不同的值!我的代码的问题是,第一个selectInput被阻止为相同的初始值,而它必须更改并防止第二个每次都有其值

ui <- fluidPage(
    fileInput('file1', 'Upload your  CSV File'),
    htmlOutput("variables"),
    htmlOutput("facteurs"),
    uiOutput("tb"))
server <- function(input, output, session) {
  myData1 <- reactive({
    inFile <- input$file1
    if (is.null(inFile)) return(NULL)
    data <- read.csv(inFile$datapath, header = TRUE,row.names=1)
    data
  })
  output$variables <- renderUI({
    df_init <- myData1() 
    x=sapply(df_init,class)
    x=(x=="numeric")
    df=df_init[,x]
    if (identical(df, '') || identical(df,data.frame())) return(NULL)
    selectInput(inputId = "V1", label = "Variables to use: Y", choices=names(df), selected=names(df[1]))
  })
  output$facteurs <- renderUI({
    df_init <- myData1() 
     x=sapply(df_init,class)
    x=(x=="factor")
    df=df_init[,x]
    if (identical(df, '') || identical(df,data.frame())) return(NULL)
       verticalLayout(
        selectInput(inputId = "F11", label = "Factors to use: X1", choices=names(df)),
        selectInput(inputId = "F12", label = "Factors to use: X2", choices=names(df)[names(df)!=input$F11]))
   })}
shinyApp(ui = ui, server = server)

欢迎来到Stackoverflow。我是《闪亮的代码》方面的专家,目前来看,这个问题无法回答。我建议暂时搁置这一问题,直到提供进一步的细节。请编辑您的问题,以包含您的
应用程序的所有代码。此外,您需要准确描述您想要做什么,并提供/描述一些示例数据。如需指导,请查看页面和。欢迎!一个可复制的例子确实会有帮助。在服务器端,您可以使用smthg,比如
output$UIF12。我已经用更好的方式更新了这个问题!
,Var,Lo,ES,Acidity,K232,K270,IP,OS,C 14:0,C 16:0,C 16:1,C 17:0,C 17:1,C 18:0,C 18:1,C 18:2,C 18:3,C 20:0,C 20:1,total,LLL,LnLO,LnLP,LLO,LnOO,PLL,LOO,LOP,PLP,OOO,POP,POO,AOL,SOO,SOP,Chlorophyll,b carotène,polyphenols ,Ethyl acetate,2- Methyl butanal,3- Methyl butanal,1-Penten-3-one,3-Hexanone,Hexanal,3-Pentanol,Trans-2-pentenal,1-Penten-3-ol,Cis-3-hexenal,Trans-2-hexenal,1-Pentanol,Hexyl acetate,Cis-3-hexenyl acetate,Cis-2-pentenol,6-Methyl-5-hepten-2-one,1-Hexanol,Trans-3-hexenol,Cis-3-hexenol,Trans-2-hexenol,Acetic acid,Butyric acid,H-   Tyr      ,Tyr ,DFOA,DFLA,Ac-Pin,Pin,EAA,OA,LA,total phenols (HPLC)
P1,chetoui,beja,sp,0.93,1.49,0.2,9.2,16.51,0.01,13.5,0.57,0.07,0.08,2.57,67.04,18.56,1.16,0.02,0.39,103.95,0.72,0.45,0.1,7.87,2.63,0.38,22.14,8.8,0.7,33.47,15.84,1.77,0.37,3.95,0.8,5.05,4.1,491.6,2.72,0.29,0.11,0.08,0.1,15.27,1.35,1.55,3.77,22.68,133.13,0.36,9.92,7.14,2.37,0.5,10.03,0.78,121.11,14.12,0.05,0.08,1.91,4.15,10.33,40.52,1.21,5.5,2.92,30.65,2.35,99.53
P2,chetoui,beja,sp,0.36,1.24,0.2,8.2,16.81,0.01,13.39,0.18,0.05,0.07,1.23,69.23,18.63,0.91,0.02,0.28,104,0.69,0.43,0.15,7.81,2.57,0.42,22.21,8.84,0.71,33.87,15.6,2.01,0.38,4.14,1.01,5.88,6.161,457.04,2.52,0.34,0.12,0.09,0.22,15.2,1.32,1.52,3.67,22.61,133.19,0.35,9.89,7.18,2.34,0.51,10.17,0.75,121.21,14.29,0.05,0.02,1.92,4.05,10.45,40.63,1.25,5.55,2.95,31.042,2.17,100.01
P3,chetoui,beja,sp,0.84,1.87,0.21,8.6,16.73,0.01,13.31,0.45,0.06,0.08,2.54,69.29,17.03,0.84,0.02,0.37,104,0.72,0.42,0.12,7.82,2.61,0.43,21.22,8.83,0.72,33.85,15.52,1.92,0.39,4.05,0.95,5.92,6.241,482.12,2.72,0.25,0.08,1.12,0.42,15.01,1.3,1.44,3.93,22.51,133.07,0.39,9.87,7.16,2.31,0.52,10.1,0.76,121.29,14.21,0.06,0.01,1.93,4.12,10.6,40.71,1.26,5.54,2.96,30.43,2.26,99.81