Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move the "Decision Threshold" without redrawing everything? #21

Open
ignacio82 opened this issue Dec 1, 2017 · 0 comments
Open

Move the "Decision Threshold" without redrawing everything? #21

ignacio82 opened this issue Dec 1, 2017 · 0 comments

Comments

@ignacio82
Copy link
Owner

First, I'm not sure if this is possible or not. Right now whenever you change the threshold in a shiny app, the whole figure gets redrawn from scratch. This is a bit misleading because the threshold does not affect the rest of the figure. This is a basic example:

example

## app.R ##
library(shiny)
library(shinydashboard)
library(IMPosterior) 
set.seed(9782)
x <- rnorm(n = 1000, mean = 3, sd = 2)

ui <- dashboardPage(
  dashboardHeader(),
  dashboardSidebar(
    sliderInput(
      "threshold",
      h4("Decision Threshold:"),
      min = 50,
      max = 99,
      value = 75,
      step = 1,
      post = "%"
    )
  ),
  dashboardBody(
    box(
      title = "Posterior Distribution",
      status = "primary",
      solidHeader = TRUE,
      width = 6,
      IMPosteriorOutput("plot", width = "100%")
    )
  )
)

server <- function(input, output) { 
  
  output$plot <- renderIMPosterior({
    p <- IMPosterior(x = x, MME = 1, threshold = input$threshold/100)
    return(p)
  })
  
}

shinyApp(ui, server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant