-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.R
133 lines (127 loc) · 3.03 KB
/
ui.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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# Plant phenology
library(shiny)
library(ggplot2)
library(magrittr)
library(tidyverse)
library(stringr)
library(shinyWidgets)
library(cicerone)
library(shinyjs)
library(shinyBS)
library(plotly)
# specify choices
specs <- c("Amelanchier canadensis", "Cichorium intybus", "Erigeron canadensis", "Erigeron pulchellus", "Vaccinium corymbosum")
months <- c(
"January" = "Jan",
"February" = "Feb",
"March" = "Mar",
"April" = "Apr",
"May" = "May",
"June" = "Jun",
"July" = "Jul",
"August" = "Aug",
"September" = "Sep",
"October" = "Oct",
"November" = "Nov",
"December" = "Dec",
"Annual" = "Annual",
"January through April" = "JanApr"
)
# Load data
clim.dat <- read.csv("Ex2_climatedata.csv")
shinyUI <- fluidPage(
id = "page",
use_cicerone(),
# setBackgroundColor(color = "#C7DAE0"),
setBackgroundColor(color = "white"),
useShinyjs(),
tags$head(
tags$link(rel = "icon", href = "favicon.ico", type = "image/x-icon") ),
title = "Plant phenology",
includeMarkdown("include.md"),
actionBttn(
inputId = "reset1",
label = "Reset",
style = "material-flat",
color = "danger",
size = "xs"
),
bsTooltip("reset1", "If you have already changed the variables, reset them to default here before starting the tour."),
actionBttn(
inputId = "tour1",
label = "Take a tour!",
style = "material-flat",
color = "success",
size = "sm"
),
hr(),
sidebarLayout(
sidebarPanel(
div(
id = "month1-wrapper",
pickerInput("clim.month", "Month", choices = months)
),
br(),
div(
id = "year-wrapper",
sliderInput("year", "Range of years",
min = min(clim.dat$Year),
max = max(clim.dat$Year),
value = c(min(clim.dat$Year), max(clim.dat$Year)),
sep = "", step = 1
)
)
),
mainPanel(
plotOutput(outputId = "ClimatePlot", width = "800px", height = "600px"),
htmlOutput("stats")
)
),
hr(),
includeMarkdown("include2.md"),
br(),
actionBttn(
inputId = "reset2",
label = "Reset",
style = "material-flat",
color = "danger",
size = "xs"
),
bsTooltip("reset2", "If you have already changed the variables, reset them to default here before starting the tour."),
actionBttn(
inputId = "tour2",
label = "Take a tour!",
style = "material-flat",
color = "success",
size = "sm"
),
hr(),
div(
id = "viz-wrapper",
sidebarLayout(
sidebarPanel(
div(
id = "month2-wrapper",
pickerInput("month", "Month", choices = months)
),
div(
id = "spec-wrapper",
pickerInput("species", "Species",
choices = specs, multiple = TRUE, selected = specs[1],
options = list(`actions-box` = TRUE)
)
),
width = 3
),
mainPanel(
# h4("ggplot"),
# plotOutput(outputId = "PhenologyPlot"),
# hr(),
# h4("Plotly"),
plotlyOutput(outputId = "PhenologyPlotly"),
width = 9
)
)
),
hr()
)