Skip to content

Commit 0d34ffe

Browse files
committed
add reference and more comments to the server code
1 parent 44dc082 commit 0d34ffe

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

server.R

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,23 @@
1-
function(input, output) {
1+
# This code was adapted from the Shiny R package examples:
2+
# https://github.com/rstudio/shiny-examples/tree/main/083-front-page
23

3-
output$main_plot <- renderPlot({
44

5+
function(input, output) {
6+
# Main plot
7+
output$main_plot <- renderPlot({
8+
# Histogram plot
59
hist(old_faithful$eruptions,
610
probability = TRUE,
711
breaks = as.numeric(input$n_breaks),
812
xlab = "Duration (minutes)",
913
main = "Geyser eruption duration")
10-
14+
15+
# Adds individual observations to plot
1116
if (input$individual_obs) {
1217
rug(old_faithful$eruptions)
1318
}
14-
19+
20+
# Adds density estimates to plot
1521
if (input$density) {
1622
dens <- density(old_faithful$eruptions,
1723
adjust = input$bw_adjust)

0 commit comments

Comments
 (0)