I'm trying to "create a probability calculator for Normal and Binomial distributions, but this is giving some error when it generates HTML." .Select the codes below.
PS: Would it be possible to exchange mi and sigma for Greek letters?
library(shiny)
ui<-fluidPage(
titlePanel("Calculadora"),
sidebarLayout(
sidebarPanel(
selectInput(inputId="dist",
label="Escolha sua distribuição:",
choices=c("Binomial"="bin","Normal"="normal"),selected = "bin"),
sliderInput(inputId="x",label="Escolha o valor de X:",
min=0,max=50,step = 1,value = 10),
conditionalPanel(condition = "input.dist=='bin'",
sliderInput(inputId = "n",label = "Escolha o valor de N:",
min=0,max=50,step=1,value=25),
sliderInput(inputId ="p",label="Escolha o valor de P",
min=0,max = 1,value=0.5)),
conditionalPanel(condition = "input.dist=='normal'",
sliderInput(inputId = "s",label = "Escolha o valor de sigma",
min=0,max=50,step=1,value=25),
sliderInput(inputId ="m",label="Escolha o valor de mi",
min=0,max=50,step=1,value=25))
),
mainPanel(textOutput("text_calc"))
)
)
server <- function(input, output) {
output$text_calc<-renderPrint({
if (input$dist=="bin"){
N<-input$n
P<-input$p
k<-input$x
D<-pbinom(k,N,P)
paste("Probabilidade pedida:", D)
}
if (input$dist=="normal"){
S<-input$s
M<-input$m
k<-input$x
D<-pnorm(k,M,S)
paste("Probabilidade pedida:", D)
}
}
)
}
shinyApp(ui,server)