Debian Codegraph @

tests/test-encoding/01-symbols/app.R

raw
1 library(shiny)
2 app <- shinyApp(
3 ui = fluidPage(
4 "\u2264 and \u2265",
5 uiOutput("bin_prob_k"),
6 uiOutput("bin_prob_inequality"),
7 uiOutput("bin_prob_out"),
8 plotOutput("pmf")
9 ),
10 server = function(input, output) {
11
12 output$bin_prob_k = renderUI({
13 numericInput("binom4_k", label = "Number of successes (k)", value = 3,
14 step = 1, min = 0, max = 10)
15 })
16
17 bin_choices = reactive({
18 nms = paste("P(X",c("=","\u2264","<","\u2265",">"),input$binom4_k,")",sep="")
19 return(nms)
20 })
21
22 output$bin_prob_inequality = renderUI({
23 selectInput("bin_prob_type", label = "Inequality type", choices = bin_choices())
24 })
25
26 output$pmf <- renderPlot({
27 n=10
28 prob = 0.4
29 probs = dbinom(0:n, size=n, prob=prob)
30 mtext(input$bin_prob_type, side = 3, col = "red", cex = 1.2)
31 })
32
33 output$bin_prob_out = renderUI({
34 withMathJax(paste0("\\(",input$bin_prob_type,"\\)",sep=""))
35 })
36
37 }
38 )