Spaces:
Sleeping
Sleeping
FreddyHernandez
commited on
Commit
•
8792327
1
Parent(s):
c798656
Upload 2 files
Browse files
server.R
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
library(shiny)
|
2 |
+
|
3 |
+
shinyServer(function(input, output)
|
4 |
+
{
|
5 |
+
|
6 |
+
output$grafico1 <- renderPlot({
|
7 |
+
curve(dnorm(x, mean=input$media, sd=input$desvi),
|
8 |
+
from=input$media - 3 * input$desvi,
|
9 |
+
to=input$media + 3 * input$desvi,
|
10 |
+
ylab="Densidad",
|
11 |
+
las=1, lwd=3, col="deepskyblue3")
|
12 |
+
grid()
|
13 |
+
})
|
14 |
+
|
15 |
+
output$med_var <- renderText({
|
16 |
+
a <- input$media
|
17 |
+
b <- input$desvi
|
18 |
+
esperanza <- a
|
19 |
+
varianza <- b^2
|
20 |
+
paste(c("Para esta configuración E(X) =", round(esperanza, 2),
|
21 |
+
"con Var(X) =", round(varianza, 2)))
|
22 |
+
})
|
23 |
+
|
24 |
+
})
|
ui.R
ADDED
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
library(shiny)
|
2 |
+
|
3 |
+
shinyUI(fluidPage(
|
4 |
+
|
5 |
+
# Application title
|
6 |
+
titlePanel("Distribución Normal"),
|
7 |
+
|
8 |
+
sidebarLayout(
|
9 |
+
sidebarPanel(
|
10 |
+
HTML("Modifique los valores de los parámetros y
|
11 |
+
observe lo que sucede con la densidad."),
|
12 |
+
br(),
|
13 |
+
br(),
|
14 |
+
numericInput(inputId = "media",
|
15 |
+
label = HTML("Ingrese el valor de la media:"),
|
16 |
+
min = -5000,
|
17 |
+
max = 5000,
|
18 |
+
value = 1.5,
|
19 |
+
step= 0.1),
|
20 |
+
numericInput(inputId = "desvi",
|
21 |
+
label = HTML("Ingrese el valor de la desviación:"),
|
22 |
+
min = 0.001,
|
23 |
+
value = 1.5,
|
24 |
+
step= 0.1),
|
25 |
+
br(),
|
26 |
+
p("App creada por el Semillero de R de la Universidad Nacional de Colombia:"),
|
27 |
+
tags$a(href="https://srunal.github.io/",
|
28 |
+
"https://srunal.github.io/")
|
29 |
+
),
|
30 |
+
|
31 |
+
# Show a plot of the generated distribution
|
32 |
+
mainPanel(
|
33 |
+
h3("Densidad para la distribución Normal", align = "center"),
|
34 |
+
plotOutput("grafico1"),
|
35 |
+
verbatimTextOutput('med_var')
|
36 |
+
)
|
37 |
+
)
|
38 |
+
))
|