R 使用数据调用反应函数以呈现UI

R 使用数据调用反应函数以呈现UI,r,shiny,reactive-programming,R,Shiny,Reactive Programming,我有以下数据集。我想选择汽车品牌,它应该在下一次选择中自动更新该品牌的相应车型 例如,假设数据集如下所示 dataset.csv KIA Ford Sportage Mustang sorento Explorer 代码: server试试看 不能将变量放在$的右侧,请改用[] server <- function(input, output) { abc<-reactive({

我有以下数据集。我想选择汽车品牌,它应该在下一次选择中自动更新该品牌的相应车型 例如,假设数据集如下所示

dataset.csv  KIA         Ford
            Sportage   Mustang
            sorento      Explorer
代码:

server试试看

不能将变量放在
$
的右侧,请改用
[]

server <- function(input, output) {   
    abc<-reactive({
        abc <- fread("dataset.csv")
    })
    output$choose_brand<-renderUI({
        selectInput("brand","brand",names(abc()))
    })
    output$choose_model<-renderUI({
        # the error is here.how can I call dataset 
        # abc and select a column from that dataset
        selectInput("model","model",a()$input$brand)
    })
}
selectInput("model","model",abc()[input$brand])