Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement for Milestone 4 - Sneha #75

Merged
merged 2 commits into from
Mar 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 38 additions & 8 deletions app.R
Original file line number Diff line number Diff line change
Expand Up @@ -325,9 +325,12 @@ server <- function(input, output, session) {
filter(month >= input$month_range[1], month <= input$month_range[length(input$month_range)]) %>%
group_by(city) %>%
summarize(
avg_temp = round(mean(temp_f, na.rm =TRUE), 2),
min_temp = min(temp_f, na.rm =TRUE),
max_temp = max(temp_f, na.rm =TRUE),
avg_temp_ft = round(mean(temp_f, na.rm =TRUE), 2),
min_temp_ft = min(temp_f, na.rm =TRUE),
max_temp_ft = max(temp_f, na.rm =TRUE),
avg_temp_cs = round(mean(temp_c, na.rm =TRUE), 2),
min_temp_cs = min(temp_c, na.rm =TRUE),
max_temp_cs = max(temp_c, na.rm =TRUE),
avg_prec = round(mean(precip, na.rm =TRUE), 2),
min_prec= min(precip, na.rm =TRUE),
max_prec = max(precip, na.rm =TRUE)
Expand All @@ -337,10 +340,20 @@ server <- function(input, output, session) {
# create max summary statistic box
output$maxBox <- renderValueBox({
if (input$data_type == "Temperature") {
valueBox(
paste0(stat_data()$max_temp, "°F"), "MAX", icon = icon("fa-light fa-sun"),
color = "red"
if (input$temp_metric == "Fareinheit") {
valueBox(
paste0(stat_data()$max_temp_ft, "°F"), "MAX", icon = icon("fa-light fa-sun"),
color = "red")
}
else {
{
valueBox(
paste0(stat_data()$max_temp_cs, "°C"), "MAX", icon = icon("fa-light fa-sun"),
color = "red"

)
}
}
}
else{
valueBox(
Expand All @@ -352,10 +365,18 @@ server <- function(input, output, session) {
# create min summary statistic box
output$minBox <- renderValueBox({
if (input$data_type == "Temperature") {
if (input$temp_metric == "Fareinheit") {
valueBox(
paste0(stat_data()$min_temp, "°F"), "MIN", icon = icon("fa-light fa-sun"),
paste0(stat_data()$min_temp_ft, "°F"), "MIN", icon = icon("fa-light fa-sun"),
color = "blue"
)
}
else{
valueBox(
paste0(stat_data()$min_temp_cs, "°C"), "MIN", icon = icon("fa-light fa-sun"),
color = "blue"
)
}
}
else{
valueBox(
Expand All @@ -367,10 +388,19 @@ server <- function(input, output, session) {
# create avg summary statistic box
output$avgBox <- renderValueBox({
if (input$data_type == "Temperature") {
if (input$temp_metric == "Fareinheit") {
valueBox(
paste0(stat_data()$avg_temp, "°F"), "AVG", icon = icon("fa-light fa-sun"),
paste0(stat_data()$avg_temp_ft, "°F"), "AVG", icon = icon("fa-light fa-sun"),
color = "green"
)
}
else
{
valueBox(
paste0(stat_data()$avg_temp_cs, "°C"), "AVG", icon = icon("fa-light fa-sun"),
color = "green"
)
}
}
else{
valueBox(
Expand Down