slider - shiny sliderInput range minimum and maximum values -


i need adjust histogram output in shiny range values:

(where m arbitrary matrix)

#ui.r sliderinput(inputid="adjust", label="choose adjacency threshold", value=c(0.001, 0.9), min=0.0001, max=1), plotoutput("hist")  #server.r df<-reactive({ idx = m > min(input$adjust) & m < max(input$adjust)     data.frame(       id = row(m)[idx],       value = m[idx]) }) output$hist<-renderplot({hist(df()$values)}) 

however doesn't seem affect histogram- re-renders when toggle slider same each time.... takes long time , seems take of values in account?

does know how make work?

when try print slider's min/max value- nothing comes page:

#ui.r verbatimtextoutput("x") #server output$x<-renderprint({min(input$adjust)}) 

hence might approaching wrong way... know how this?

full example

library(shiny) runapp(list(ui = fluidpage(sliderinput(inputid="adjust", label="choose adjacency threshold", value=c(0.001, 0.9), min=0.0001, max=1), plotoutput("hist") server=function(input, output){    adjacentmat<-reactive({adjacency(dat)})    data<-reactive({     adj_mat<-adjacentmat()     adj_mat[adj_mat < input$adjust] <- 0     m<-adj_mat     idx = m > min(input$adjust) & m < max(input$adjust)     data.frame(       source = row(m)[idx],       target = col(m)[idx],       corr = m[idx])   })   output$hist<-renderplot({hist(data()$corr)}) } ) 

generate dat variable following code:

library('dplyr') set.seed(1)  # generate couple clusters nodes_per_cluster <- 30 n <- 10  nvals <- nodes_per_cluster * n  # cluster 1 (increasing)  cluster1 <- matrix(rep((1:n)/4, nodes_per_cluster) +                     rnorm(nvals, sd=1),                    nrow=nodes_per_cluster, byrow=true)  # cluster 2 (decreasing) cluster2 <- matrix(rep((n:1)/4, nodes_per_cluster) +                     rnorm(nvals, sd=1),                    nrow=nodes_per_cluster, byrow=true)  # noise cluster noise <- matrix(sample(1:2, nvals, replace=true) +                 rnorm(nvals, sd=1.5),                 nrow=nodes_per_cluster, byrow=true)  dat <- rbind(cluster1, cluster2, noise) colnames(dat) <- paste0('n', 1:n) rownames(dat) <- c(paste0('cluster1_', 1:nodes_per_cluster),                     paste0('cluster2_', 1:nodes_per_cluster),                    paste0('noise_',    1:nodes_per_cluster)) 

this works me:

library(shiny) runapp(list(ui = fluidpage(   mainpanel(sliderinput("test", "select values", value= c(.001,.9), min= 0.0001, max= 1)),   verbatimtextoutput("test2")   ),   server = function(input, output, session) {     output$test2 <- renderprint(min(input$test))   })) 

i'm guessing problem somewhere in code haven't shown us. can give code entire running example of problem?


Comments