Spaces:
Running
Running
Commit
·
0fc3d4a
1
Parent(s):
7da4a08
Upload 2 files
Browse files
server.R
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(shiny)
|
| 2 |
+
|
| 3 |
+
shinyServer(function(input, output) {
|
| 4 |
+
|
| 5 |
+
output$grafico1 <- renderPlot({
|
| 6 |
+
prob <- dgeom(x=0:input$x, prob=input$p)
|
| 7 |
+
barplot(prob, ylim=c(0, 1), names.arg=0:input$x,
|
| 8 |
+
xlab="x", ylab=expression(P(X==x)), col="deepskyblue3", las=1)
|
| 9 |
+
grid()
|
| 10 |
+
})
|
| 11 |
+
})
|
ui.R
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
library(shiny)
|
| 2 |
+
|
| 3 |
+
shinyUI(fluidPage(
|
| 4 |
+
|
| 5 |
+
# Application title
|
| 6 |
+
titlePanel("Distribución geométrica"),
|
| 7 |
+
|
| 8 |
+
sidebarLayout(
|
| 9 |
+
sidebarPanel(
|
| 10 |
+
p("Modifique el valor del parámetro p y observe
|
| 11 |
+
lo que sucede en el diagrama."),
|
| 12 |
+
br(),
|
| 13 |
+
sliderInput(inputId = "p",
|
| 14 |
+
label = "Probabilidad de éxito p:",
|
| 15 |
+
min = 0,
|
| 16 |
+
max = 1,
|
| 17 |
+
value = 0.1,
|
| 18 |
+
step= 0.1,
|
| 19 |
+
animate = TRUE),
|
| 20 |
+
numericInput(inputId = "x",
|
| 21 |
+
label = "Ingrese el máximo valor de x para el cual desea
|
| 22 |
+
ver las probabilidades:",
|
| 23 |
+
min = 1,
|
| 24 |
+
max = 30,
|
| 25 |
+
value = 20,
|
| 26 |
+
step = 1),
|
| 27 |
+
br(),
|
| 28 |
+
p("App creada por el Semillero de R de la Universidad Nacional de Colombia:"),
|
| 29 |
+
tags$a(href="https://srunal.github.io",
|
| 30 |
+
"https://srunal.github.io")
|
| 31 |
+
),
|
| 32 |
+
|
| 33 |
+
# Show a plot of the generated distribution
|
| 34 |
+
mainPanel(
|
| 35 |
+
h3("Diagrama de barras para las probabilidades", align = "center"),
|
| 36 |
+
plotOutput("grafico1")
|
| 37 |
+
)
|
| 38 |
+
)
|
| 39 |
+
))
|