inst/shinyapps/mdaplot/server.r

shiny::shinyServer(function(input, output) {

  # Expression that generates a histogram. The expression is
  # wrapped in a call to renderPlot to indicate that:
  #
  #  1) It is "reactive" and therefore should re-execute automatically
  #     when inputs change
  #  2) Its output type is a plot

  output$distPlot1 <- shiny::renderPlot( {

    media <- input$media
    dest <- input$dest
    asim <- input$asim

    set.seed(1)
    x <- sn::rsn(1000, xi = media, omega = dest, alpha = asim)

    # draw the histogram with the specified number of bins
    hist(x, breaks = 20, col = "darkgray", border = "white",
         xlim = c(-15, 15), main = "Histograma")
  })

  output$distPlot2 <- shiny::renderPlot( {

    media <- input$media
    dest <- input$dest
    asim <- input$asim

    set.seed(1)
    x <- sn::rsn(1000, xi = media, omega = dest, alpha = asim)

    # draw the histogram with the specified number of bins
    boxplot(x, col = "darkgray", ylim = c(-15,15),
            main = "Boxplot", horizontal = TRUE)
  })

})
reyzaguirre/rhep documentation built on Dec. 2, 2024, 4:22 p.m.