FreddyHernandez
commited on
Nuevos archivos
Browse files
server.R
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#
|
2 |
+
# This is the server logic of a Shiny web application. You can run the
|
3 |
+
# application by clicking 'Run App' above.
|
4 |
+
#
|
5 |
+
# Find out more about building applications with Shiny here:
|
6 |
+
#
|
7 |
+
# https://shiny.posit.co/
|
8 |
+
#
|
9 |
+
|
10 |
+
library(shiny)
|
11 |
+
|
12 |
+
# Define server logic required to draw a histogram
|
13 |
+
function(input, output, session) {
|
14 |
+
|
15 |
+
output$distPlot <- renderPlot({
|
16 |
+
|
17 |
+
# generate bins based on input$bins from ui.R
|
18 |
+
x <- faithful[, 2]
|
19 |
+
bins <- seq(min(x), max(x), length.out = input$bins + 1)
|
20 |
+
|
21 |
+
# draw the histogram with the specified number of bins
|
22 |
+
hist(x, breaks = bins, col = 'darkgray', border = 'white',
|
23 |
+
xlab = 'Waiting time to next eruption (in mins)',
|
24 |
+
main = 'Histogram of waiting times')
|
25 |
+
|
26 |
+
})
|
27 |
+
|
28 |
+
}
|
ui.R
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#
|
2 |
+
# This is the user-interface definition of a Shiny web application. You can
|
3 |
+
# run the application by clicking 'Run App' above.
|
4 |
+
#
|
5 |
+
# Find out more about building applications with Shiny here:
|
6 |
+
#
|
7 |
+
# https://shiny.posit.co/
|
8 |
+
#
|
9 |
+
|
10 |
+
library(shiny)
|
11 |
+
|
12 |
+
# Define UI for application that draws a histogram
|
13 |
+
fluidPage(
|
14 |
+
|
15 |
+
# Application title
|
16 |
+
titlePanel("Old Faithful Geyser Data"),
|
17 |
+
|
18 |
+
# Sidebar with a slider input for number of bins
|
19 |
+
sidebarLayout(
|
20 |
+
sidebarPanel(
|
21 |
+
sliderInput("bins",
|
22 |
+
"Number of bins:",
|
23 |
+
min = 1,
|
24 |
+
max = 50,
|
25 |
+
value = 30)
|
26 |
+
),
|
27 |
+
|
28 |
+
# Show a plot of the generated distribution
|
29 |
+
mainPanel(
|
30 |
+
plotOutput("distPlot")
|
31 |
+
)
|
32 |
+
)
|
33 |
+
)
|