r - shiny app stops if there are >152 selectInputs when deployed over the spark server -
i have shiny app @ point creates 1 selectinput each column of table data set uploaded user. when input data set contains 152 columns, 152 selectinputs produced , further analyses done expected. however, when input file contains 153 or more columns, app starts building list of selectinputs stops (the screen turns grey). problems not occur when app run locally when hosted @ spark.rstudio.com. have not found specific errors in log file.
here how function produce multiple selectinputs described in server.r:
output$selectui<-renderui({ if (is.null(input$taxtax)) { return(null) } progress <- progress$new(session, min=1, max=10) on.exit(progress$close()) progress$set(message = 'preparing optional adjustment of feeding types', detail = 'please wait...') (i in 1:10) { progress$set(value = i) sys.sleep(0.05) } library(gdata) tax<-read.xls(input$taxtax$datapath,check.names=f) tax[,-(1:2)]<-sapply(tax[,-(1:2)],as.character) tax[,-(1:2)]<-sapply(tax[,-(1:2)],as.numeric) names(tax)[1]<-"a" names(tax)[2]<-"b" dup<-which(duplicated(names(tax))==t) dupl<-length(dup) namesl<-length(names(tax)) if (dupl>0) { duplindicator<-1 megadupset<-vector() (i in 1:dupl) { dupset<-which(names(tax)[1:namesl]==names(tax)[dup[i]]) megadupset<-append(megadupset,dupset) dupsum<-rowsums(tax[dupset]) dupname<-names(tax)[dupset][1] dupsum<-cbind(dupsum) colnames(dupsum)<-dupname tax<-cbind(tax,dupsum) } tax<-tax[-megadupset] del<-grep(".",names(tax),fixed=t) if (length(del)>0) { tax<-tax[-del] } } tax<-tax[,-1] dat<-read.xls("database.xls") if (is.null(input$additem)==f){ datadditem<-data.frame(input$additem[-1,]) names(datadditem)<-names(dat) dat<-rbind(dat,datadditem) dat<-dat[order(as.character(dat[,1])),] dat[,2]<-as.integer(dat[,2]) dat[,3]<-as.integer(dat[,3]) dat[,4]<-as.numeric(dat[,4]) } taxa<-tax[,-1] c<-ncol(taxa) i<-1 found<-vector() guess<-vector() (i in 1:c) { taxon<-names(taxa)[i] i<-i+1 feed<-dat[dat["taxon"]==taxon][3] if (is.na(feed)==true) { found.value<-taxon found<-append(found,found.value) } } if (length(found)==0) { c<-ncol(taxa) i<-1 feedvector<-vector() (i in 1:c) { taxon<-names(taxa)[i] if (dat[dat["taxon"]==taxon][5]=="") { feed<-dat[dat["taxon"]==taxon][3] } else { feed<-paste(dat[dat["taxon"]==taxon][3],dat[dat["taxon"]==taxon][5],sep="") } feedvector<-append(feedvector,feed) i<-i+1 } # sorting sort<-order(substr(feedvector,1,1),names(taxa)) i<-1 (i in 1:c) { if (feedvector[i]==1) feedvector[i]<-"herbivores" if (feedvector[i]=="1a") feedvector[i]<-"herbivores - sedentary parasites" if (feedvector[i]=="1b") feedvector[i]<-"herbivores - migratory endoparasites" if (feedvector[i]=="1c") feedvector[i]<-"herbivores - semi-endoparasites" if (feedvector[i]=="1d") feedvector[i]<-"herbivores - ectoparasites" if (feedvector[i]=="1e") feedvector[i]<-"herbivores - epidermal/root hair feeders" if (feedvector[i]=="1f") feedvector[i]<-"herbivores - algal/lichen/moss feeders" if (feedvector[i]==2) feedvector[i]<-"fungivores" if (feedvector[i]==3) feedvector[i]<-"bacterivores" if (feedvector[i]==5) feedvector[i]<-"predators" if (feedvector[i]==7) feedvector[i]<-"animal parasites (dispersal stages)" if (feedvector[i]==8) feedvector[i]<-"omnivores" } x<-length(feedvector) outputlist<-list() i<-1 (i in sort) { output<-selectinput(paste("feed",i,sep=""), colnames(taxa)[i], c("herbivores - sedentary parasites"="1a","herbivores - migratory endoparasites"="1b","herbivores - semi-endoparasites"="1c","herbivores - ectoparasites"="1d","herbivores - epidermal/root hair feeders"="1e","herbivores - algal/lichen/moss feeders"="1f","fungivores"=2,"bacterivores"=3,"predators"=5,"animal parasites (dispersal stages)"=7,"omnivores"=8), selected=feedvector[i]) outputlist<-append(outputlist,output) } outputlist } else {return(null)} })
the corresponding line in ui.r:
htmloutput(selectui)
Comments
Post a Comment