-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworksheet-8-4.R
49 lines (42 loc) · 1.02 KB
/
worksheet-8-4.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
# Libraries
library(ggplot2)
library(dplyr)
# Data
species <- read.csv('data/species.csv', stringsAsFactors = FALSE)
animals <- read.csv('data/animals.csv', na.strings = '', stringsAsFactors = FALSE)
# User Interface
in1 <- selectInput(inputId = 'pick_species',
label = 'Pick a Species',
choices = unique(species[['id']]))
in2 <- ...('slider_months',
...,
...,
...,
...)
side <- sidebarPanel('Options', ...)
out2 <- plotOutput('species_plot')
main <- mainPanel(out2)
tab <- tabPanel(title = 'Species',
sidebarLayout(side, main))
ui <- navbarPage('Portal Project', tab)
# Server
server <- function(input, output) {
... <- reactive(
...
...
)
output[['species_plot']] <- renderPlot(
animals %>%
filter(id == input[['pick_species']]) %>%
...
ggplot(aes(year)) +
geom_bar()
)
... <- renderDataTable(
...
...
...
)
}
# Create the Shiny App
shinyApp(ui = ui, server = server)