r - Shiny slider - retrieving values - list, or..? -


i have shiny app using renderui in server.r create set of sliders, since not know ahead of time how many sliders need created. works on webpage end, i'm having trouble retrieving set values. here renderui function in code:

output$sliders <- renderui({ if (input$unequalpts == "no")     return(null) updatetabsetpanel(session, "intabset", selected = "unequal") theshp <- myshpdata() thestrata <- unique(as.character(theshp$shnystr)) numstrata <- nlevels(theshp$shnystr)  lapply(1:numstrata, function(i) {       sliderinput(inputid = paste0("strata", i), label = paste("strata ", thestrata[i]),       min = 0, max = 100, value = c(0, 100), step = 1)       }) }) 

here how trying retrieve values in later reactive function of server.r:

print("getting slider values...") mysliders<- null theshp <- myshpdata() numstrata <- nlevels(theshp$shnystr) mysliders <- lapply(1:numstrata, function(i) {     input[[paste0("strata", i)]]     }) grtspts <-(mysliders) print("input sliders are") print(grtspts) 

when this, result of print(grtspts) follows:

browse[2]> grtspts [[1]] [1]  0 25  [[2]] [1]  0 41  [[3]] [1]  0 22 

which not want; want list [25,41,22]. don't know why i'm not getting simple list, rather, appears list of lists? or .. don't know; don't understand leading zeroes are, there before each set slider values. how extract 25, say, vs. 0 25, grtspts?

when declare sliderinput's assign value = c(0, 100). documentation on sliderinput

the initial value of slider. numeric vector of length 1 create regular slider; numeric vector of length 2 create double-ended range slider. warning issued if value doesn't fit between min , max

you have created double-ended range slider , hence returned 2 values. second value can use

input[[paste0("strata", i)]][2]


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -