-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhistogram.R
More file actions
92 lines (82 loc) · 2.4 KB
/
histogram.R
File metadata and controls
92 lines (82 loc) · 2.4 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
### Generate Histogram of random nubers ###
library(shiny)
ui<- fluidPage( sliderInput(inputId = "num",
label = "Chose a number",
value = 100, min = 1, max = 1000),
textInput(inputId = "title",
label = "Write a title",
value = c("Histogram of Random Normal variables")
),
plotOutput("hist"),
verbatimTextOutput("stats")
)
server<- function(input, output){
inputData<- reactive({rnorm(input$num)})
output$hist <- renderPlot({
hist(inputData(), main = input$title)
})
output$stats<- renderPrint({
summary(inputData())
})
}
shinyApp(ui=ui, server= server)
#############
# ### Shiny Library ###
# library(shiny)
#
# ### UI ###
# shinyUI(bootstrapPage(
#
# selectInput(inputId = "n_breaks",
# label = "Number of bins in histogram (approximate):",
# choices = c(10, 20, 35, 50),
# selected = 20),
#
# checkboxInput(inputId = "individual_obs",
# label = strong("Show individual observations"),
# value = FALSE),
#
# checkboxInput(inputId = "density",
# label = strong("Show density estimate"),
# value = FALSE),
#
# plotOutput(outputId = "main_plot", height = "300px"),
#
# # Display this only if the density is shown
# conditionalPanel(condition = "input.density == true",
# sliderInput(inputId = "bw_adjust",
# label = "Bandwidth adjustment:",
# min = 0.2, max = 2, value = 1, step = 0.2)
# )
#
# ))
#
#
# ### Server ###
# shinyServer(function(input, output) {
#
# output$main_plot <- renderPlot({
#
# hist(faithful$eruptions,
# probability = TRUE,
# breaks = as.numeric(input$n_breaks),
# xlab = "Duration (minutes)",
# main = "Geyser eruption duration")
#
# if (input$individual_obs) {
# rug(faithful$eruptions)
# }
#
# if (input$density) {
# dens <- density(faithful$eruptions,
# adjust = input$bw_adjust)
# lines(dens, col = "blue")
# }
#
# })
# })
#
#
# ### Run App ###
# shinyApp(ui=ui, server= server)
##################