-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathui.R
166 lines (110 loc) · 6.94 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#main
library("httr")
library("dplyr")
library("plotly")
library("shiny")
library('leaflet')
library("shinythemes")
vars <- c(
"Lot Size" = "sqft_lot15",
"Living Space" = "sqft_living15",
"Price" = "price"
)
shinyUI(fluidPage(theme = shinytheme("darkly"),
navbarPage("Housing Sales in King County, WA", id="nav",
############## FAQ TAB ##################
tabPanel("Frequently Asked Questions",
div(class="outer"),
modalDialog(h3("Hey, what's your name?"),textInput("user", label = "",placeholder = 'Type here..'), title = NULL, footer = modalButton("Let me in"),
size = "s", easyClose = FALSE, fade = TRUE),
p(h2(textOutput('user'))),
br(),
"Q: What are the average number of bedrooms in the houses priced over 1 million?",
textOutput("answer1"),
br(),
br(),
"Q: What are the average number of bathrooms in the houses priced over 1 million?",
textOutput("answer2"),
br(),
br(),
"Q: What is the average price of the houses in the best condition?",
tableOutput("answer3"),
br(),
br(),
"Q: What is the price of the house with the largest/smallest area (in sqft) including the basement? Choose one of the options below:",
radioButtons("Area",
label = "Area:",
choices = c("smallest area" = "min", "largest area" = "max"),
inline = TRUE
),
textOutput("answer4"),
br(),
br(),
"Q: What is the average price of the houses with the selected grade? Select the grade below:",
p(em("(Overall grade given to the housing unit, based on King County grading system. Range: 1-13)")),
sliderInput("Grade",
label = "Grade:",
min = min(house.data$grade),
max = max(house.data$grade),
value = min(house.data$grade),
step = 1,
ticks = TRUE,
animate = TRUE
),
textOutput("answer5"),
br(),
br(),
"Q: What is average price of the houses with a waterfront view?",
textOutput("answer6"),
br(),
br(),
"Q: What is the average price of the house in the selected zipcode? Select a zipcode below:",
p(em("(Range of zipcodes: 98001-98199)")),
numericInput("zipcode",
label = "Zipcode: ",
value = 98001,
min = 98001,
max = 98199,
step = 1),
textOutput("answer7"),
br(),
br(),
"Q: Which area in King County (zipcode) has the highest priced houses?",
textOutput("answer8"),
br()
),
########### INTERACTIVE MAP ###########
tabPanel("Interactive map",
div(class="outer"),
sidebarLayout(
sidebarPanel(
selectInput("color", "Color of the markings based on:", vars),
selectInput("size", "Size of the markings based on:", vars, selected = "price"),
numericInput("bdrm", "Size of the markings based on number of bedrooms:", 1)
),
mainPanel(
leafletOutput("map", width="100%", height="750"))
)
),
conditionalPanel("false", icon("crosshair")),
############# GRAPH TAB ##############
tabPanel("Interactive Graphs",
div(class="outer"),
p(h3("The following graphs show a few factors that affect the pricing of the house:"),
br(),
p("The scatterplot below shows the correlation between total area of houses and the price of houses:"),
p(plotlyOutput("graph1")),
br(),
p("While it could've been assumed that price would increase with the area of the house, the graph shows that price and area of the house have no correlation.
Let's dig into other factors which could affect the price of houses such as the grade given to the house, whether the house of has a waterfront view etc.")),
br(),
p("The scatterplot below shows the correlation between total area of houses and the grade of houses:"),
p(plotlyOutput("graph2")),
br(),
p("This scatterplot clearly shows that the price of the houses increases with the grade of houses."),
br(),
p("The bargraph below shows the correlation between price of the house and the houses with and without a waterfront:"),
plotlyOutput("graph3"),
p("This graph shows that the houses with a waterfornt view have a higher average price.")
)
)))