3
I am trying to "create an odds calculator for the Normal and Binomial distributions, however this giving some error when generating HTML..Follow the codes below.
PS: it would 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)
Thank you Marcus :)
– Gabriel Mizuno
It’s great to know that my response has helped you in some way. So consider vote and accept the answer, so that in the future other people who experience the same problem have a reference to solve it.
– Marcus Nunes