I have a number of apps that after uploading a datafile read the variable names and utilize selectInput controls to select independent and dependent variables. All of these controls seem to break with shiny 10.1 and 10.2. The controls are populated but as soon as you select an item the control resets. This happens both using the selectize.js version or the html version. Our server is currently running shiny 9.1 which behaves normally.
Here is the relevant part of the server.R file.
shinyServer(function(input,output){
library(foreign)
# Drop-down selection box for which data set
# output$choose_dataset <- renderUI({
# fileInput("file1", "Choose Input File")
# })
Data<-reactive({
inFile<-input$file1
if(is.null(inFile))
return(NULL)
depvar<-input$DepVar
indvars<-input$IndVars
wtvar<-input$WeightVar
gd<-num.dec$nd
df.raw<-ReadFile(inFile$datapath)
if(is.null(input$DepVar)){
depvar<-names(df.raw)[1]
}
if(is.null(input$IndVars)){
indvars<-names(df.raw)[-1]
}
# print(paste(depvar,paste(indvars,collapse="+"),sep="~"))
if(input$runstatus==0){
mod1<-NULL
}
if(input$runstatus==1){
#fmla<-as.formula(paste(depvar,paste(indvars,collapse="+"),sep="~"))
# print(depvar)
# print(indvars)
# print(names(df.raw))
fmla<-as.formula(df.raw[c(depvar,indvars)])
bindv<-FALSE
if(length(table(df.raw[[depvar]]))==2){bindv<-TRUE}
if(wtvar=="None"){
wtvar<-NULL
} else {
wtvar<-df.raw[[wtvar]]
}
mod1<-shapley.reg(fmla,mydata=df.raw,binaryDV=bindv,myweights=wtvar)
}
info<-list(df.raw=df.raw,mod1=mod1)
return(info)
})
getdigits<-observe({
tx<-input$runstatus
num.dec$nd<<-as.numeric(input$numdec)
info<-list(nd=as.numeric(input$numdec))
return(info)
})
output$raw<-renderPrint({
if(is.null(input$file1)){return()}
summary(Data()$df.raw)
})
output$DepVar<-renderUI({
if(is.null(input$file1)){return()}
selectInput('DepVar','Dependent Variable',choices=names(Data()$df.raw),
selected=names(Data()$df.raw)[1])
})
output$IndVars<-renderUI({
if(is.null(input$file1)){return()}
vars<-names(Data()$df.raw)
depvar<-input$DepVar
selectInput('IndVars','Independent Variables',choices=vars,
selected=vars[-match(depvar,vars)],multiple=TRUE,selectize=FALSE)
})
output$WeightVar<-renderUI({
if(is.null(input$file1)){return()}
vars<-names(Data()$df.raw)
wtvar<-input$WeightVar
selectInput('WeightVar','Weighting Variable',choices=c("None",vars),
selected="None")
})