-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello.R
59 lines (50 loc) · 1.3 KB
/
hello.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#' Hello
#'
#' @export
hello <- function() {
print("Hello, world!")
}
#' Hello Shiny!
#'
#' @import shiny
#'
#' @export
hello.shiny <- function() {
ui <- fluidPage(
# Application title
titlePanel("Hello Shiny!"),
# Sidebar with a slider input for number of observations
sidebarLayout(
sidebarPanel(
sliderInput("obs",
"Number of observations:",
min = 1,
max = 1000,
value = 500)
),
# Show a plot of the generated distribution
mainPanel(
plotOutput("distPlot"),
div(
img(src = system.file("www/img/helloworld.jpg", package="imageissue"))
)
)
)
)
server <- function(input, output) {
# Expression that generates a plot of the distribution. The expression
# is wrapped in a call to renderPlot to indicate that:
#
# 1) It is "reactive" and therefore should be automatically
# re-executed when inputs change
# 2) Its output type is a plot
#
output$distPlot <- renderPlot({
# generate an rnorm distribution and plot it
dist <- stats::rnorm(input$obs)
graphics::hist(dist)
})
}
hello.shiny.app <- shinyApp(ui = ui, server = server)
runApp(hello.shiny.app, launch.browser = TRUE)
}