Spaces:
Sleeping
Sleeping
FreddyHernandez
commited on
Commit
•
e521185
1
Parent(s):
7a4aac4
Upload 2 files
Browse files
server.R
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
shinyServer(function(input, output) {
|
2 |
+
|
3 |
+
output$grafico1 <- renderPlot({
|
4 |
+
prob <- dpois(x=0:input$n, lambda=input$l)
|
5 |
+
barplot(prob, ylim=c(0, 1), names.arg=0:input$n,
|
6 |
+
xlab="x", ylab=expression(P(X==x)), col="deepskyblue3", las=1)
|
7 |
+
grid()
|
8 |
+
})
|
9 |
+
})
|
ui.R
ADDED
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
library(shiny)
|
2 |
+
|
3 |
+
# Define UI for application that draws a histogram
|
4 |
+
shinyUI(fluidPage(
|
5 |
+
|
6 |
+
# Application title
|
7 |
+
titlePanel("Distribución Poisson"),
|
8 |
+
|
9 |
+
# Sidebar with a slider input for the number of bins
|
10 |
+
sidebarLayout(
|
11 |
+
sidebarPanel(
|
12 |
+
p("Modifique los valores de los parámetros y observe
|
13 |
+
lo que sucede en el diagrama"),
|
14 |
+
br(),
|
15 |
+
sliderInput(inputId = "l",
|
16 |
+
label = HTML("Media λ:"),
|
17 |
+
min = 0,
|
18 |
+
max = 40,
|
19 |
+
value = 5,
|
20 |
+
step= .1,
|
21 |
+
animate = TRUE),
|
22 |
+
numericInput(inputId = "n",
|
23 |
+
label = "Ingrese el máximo valor de x para el cual desea ver las probabilidades:",
|
24 |
+
min = 10,
|
25 |
+
max = 500,
|
26 |
+
value = 20,
|
27 |
+
step= 1),
|
28 |
+
br(),
|
29 |
+
p("App creada por el Semillero de R de la Universidad Nacional de Colombia:"),
|
30 |
+
tags$a(href="https://srunal.github.io/",
|
31 |
+
"https://srunal.github.io/")
|
32 |
+
),
|
33 |
+
|
34 |
+
# Show a plot of the generated distribution
|
35 |
+
mainPanel(
|
36 |
+
h3("Diagrama de barras para las probabilidades", align = "center"),
|
37 |
+
plotOutput("grafico1")
|
38 |
+
)
|
39 |
+
)
|
40 |
+
))
|