i have a simple shiny app and i want to create data table which will provide the rows based on the name i choose in my selectinput(). While it works normally when i choose names one after the other(first,second,third...etc) it does not respond when i choose first name, then third name, then second etc. Any suggestions?
nba <- data.frame(
player = c("James", "Durant", "Curry", "Harden", "Paul", "Wade"),
team = c("CLEOH", "GSWOAK", "GSWOAK", "HOUTX", "HOUTX", "CLEOH"),
day1points = c("25","23","30","41","26","20"),
day2points = c("24","25","33","45","26","23"),
rating=c("1","2","3","4","5","1")
)
ui.r
library(shiny)
library(DT)
ui <- navbarPage(
title="SADDAS",
sidebarLayout(
sidebarPanel(uiOutput("var1_select")),
mainPanel(tableOutput("reportOutput"))
))
server.r
server <- function(input, output) {
output$var1_select<-renderUI({
selectInput("ind_var_select","Select Names", choices =c(as.character(nba[,1] )),multiple = TRUE,selected = nba[1,1])
})
output$reportOutput = renderTable(
{subset(nba[,1:3],player==input$ind_var_select)},
options = list(scrollX = TRUE)
)
}