ADD About

This commit is contained in:
lewy 2023-06-14 12:47:55 +02:00
parent 5197de1030
commit 82af00dec6

View File

@ -2,11 +2,14 @@ library(shiny)
library(leaflet) library(leaflet)
library(ggplot2) library(ggplot2)
library(dplyr) library(dplyr)
library(shinyalert)
library(DT)
# install.packages("DT")
# Frontend # Frontend
ui <- fluidPage( ui <- fluidPage(
sidebarLayout( sidebarLayout(
sidebarPanel( sidebarPanel(
# Compound interest # Compound interest
sliderInput("range", "Compound interest:",min = 0, max = 10, value = c(4,8)),textOutput("Compound interest slider"), sliderInput("range", "Compound interest:",min = 0, max = 10, value = c(4,8)),textOutput("Compound interest slider"),
@ -22,9 +25,9 @@ ui <- fluidPage(
width = "75%" width = "75%"
), ),
# About
useShinyalert(),
actionButton("about", "?"),
width=3 width=3
@ -43,7 +46,7 @@ ui <- fluidPage(
), ),
fluid = TRUE fluid = TRUE
) )
@ -52,13 +55,34 @@ ui <- fluidPage(
# Backend # Backend
server <- function(input, output, session) { server <- function(input, output, session) {
output$table <- renderDataTable({ observeEvent(input$about, {
merged_df[, !names(merged_df) %in% c("OBS_VALUE.x", "OBS_VALUE.y", "geometry")] # Show a modal when the button is pressed
}, options = list(pageLength = 10)) shinyalert("About project:",
"Authors: Paweł Lewicki, Patryk Kaszuba\n
The aim of the project is to present growth of house prices as index of Purchasing Power Parity (PPP) in countries of European Union. 2015 is a benchmark value (100 for each country).
Datasets used:
- Eurostat Inflation 2022 - prc_hicp_aind_page_linear
- Eurostat House Price Index - prc_hpi_a__custom_3617733_page_linear
Libraries used:
shiny, leaflet, ggplot2, dplyr, shinyalert, plotly, dplyr,
tidyverse, eurostat, sf, scales, cowplot, ggthemes, RColorBrewer
Subject: Data Wizualisation
Adam Mickiewicz University,
Poznan, Poland, June 2023"
, type = "info")
})
output$table <- DT::renderDataTable({
datatable(merged_df[, !names(merged_df) %in% c("OBS_VALUE.x", "OBS_VALUE.y", "geometry")], options = list(pageLength = 10))
})
# Plot module # Plot module
output$final_plot <- renderPlotly({ output$final_plot <- renderPlotly({
final_plot <- ggplot(filter(merged_df, geo %in% input$countries), final_plot <- ggplot(filter(merged_df, geo %in% input$countries),
aes(x = TIME_PERIOD, y = house_prices_wo_hicp, color = geo, aes(x = TIME_PERIOD, y = house_prices_wo_hicp, color = geo,
text = paste("Kraj: ", geo, "<br>", "Rok: ", TIME_PERIOD, "<br>", text = paste("Kraj: ", geo, "<br>", "Rok: ", TIME_PERIOD, "<br>",
@ -83,14 +107,14 @@ server <- function(input, output, session) {
} }
plotly_plot %>% layout(showlegend = TRUE, legend = list(title = list(text = "Countries"))) plotly_plot %>% layout(showlegend = TRUE, legend = list(title = list(text = "Countries")))
}) })
# Map module # Map module
output$mymap <- renderLeaflet({ output$mymap <- renderLeaflet({
leaflet() %>% leaflet() %>%
addProviderTiles(providers$CartoDB.Positron) %>% addProviderTiles(providers$CartoDB.Positron) %>%
addPolygons(data=mapdata_new, addPolygons(data=mapdata_new,
@ -108,7 +132,7 @@ server <- function(input, output, session) {
title = "<span style='white-space: pre-line;'> Real house prices \n index (2022) </span>", title = "<span style='white-space: pre-line;'> Real house prices \n index (2022) </span>",
labels = qpal_labs, labels = qpal_labs,
opacity = 1) opacity = 1)
}) # End of map module }) # End of map module
}# End of server }# End of server