i'm trying generate list in selectinput, dynamically. have sidebarpanel in have declared tabsetpanel. each tabsetpanel have different outputs, of want display in sidebar. output of first tab selectinput or perhaps 2 selectinputs, while same go second tab.
here sidebarpanel code in ui.r
## ui.r sidebarpanel( tabsetpanel( tabpanel("az", uioutput("atozplayerlist")), tabpanel("byteam", uioutput("byteamplayerlist")) ), ),.......
in server.r, have written following:
## server.r output$atozplayerlist <- renderui({ selectinput("alphabet", "players a-z", choices=atoz, selected=0) htmloutput("list") }) output$byteamplayerlist <- renderui({ selectinput("team", "teams", choices=teamlist, selected=0) htmloutput("list") })
but not work, nothing rendered in sidebarpanel. feel i'm missing something, i'm quite new this, still haven't figured out.
i haven't been able find answer on here or elsewhere of yet. please? thanks.
you should not have 2 widgets under 1 uioutput
, recommend separate it:
## ui.r sidebarpanel( tabsetpanel( tabpanel("az", uioutput("atozplayerlist"), htmloutput("list")),... ## server.r output$atozplayerlist <- renderui({ selectinput("alphabet", "players a-z", choices=atoz, selected=0) })...
and work.
[full example]
library(shiny) fruits <- c("banana","raccoon","duck","grapefruit") ui <- pagewithsidebar( # application title headerpanel("hello shiny!"), # sidebar slider input sidebarpanel( tabsetpanel( tabpanel("az", uioutput("atozplayerlist"), htmloutput("list")), tabpanel("byteam", uioutput("byteamplayerlist")) )), # show plot of generated distribution mainpanel() ) server <- function(input,output){ output$atozplayerlist <- renderui({ selectinput("alphabet", "players a-z", choices=c("a","b","c"), selected="a") }) output$list <- renderui({ html(paste(fruits)) }) output$byteamplayerlist <- renderui({ selectinput("team", "teams", choices=c("a","b","c"), selected="b")}) } runapp(list(ui=ui,server=server))
Comments
Post a Comment