Social logements

Grigory Sharkov
29/08/2018

First Slide

The raw data can be found here:
https://opendata.paris.fr/explore/dataset/logements_sociaux_finances_a_paris/

The goal of the application is to present information about acquisition of social housing in the paris area. The application analyses this data and provides a chart with possibility how different types of housing were purchased in the frame of different programms thoughout several years.
The application can be found here:
https://gregorysharkov.shinyapps.io/SocialAppartments/.

Preparing data

library(shiny)
library(dplyr)
library(ggplot2)

ds <- read.csv2("logements_sociaux_finances_a_paris.csv", sep = ";")
ds <- ds %>% select(Year = annee.agrement,
                    NumberOfAppartments = nombre.total.de.logements.finances,
                    TypeOfRealisation = mode.de.realisation,
                    Area = arrondissement,
                    Program = nature.de.programme) %>%
  group_by(Year, TypeOfRealisation, Area, Program) %>%
  summarize(nbAppart = sum(NumberOfAppartments))

Application UI

library(shiny)

shinyUI(pageWithSidebar(
  headerPanel("Social housing in Paris"),
  sidebarPanel(
    uiOutput("choose_dataset"),
    uiOutput("choose_columns"),
    br(),
    uiOutput("selectProgram"),
    uiOutput("selectType")
  ),
  mainPanel(
    plotOutput("plot"),
    tableOutput("data_table")
  )
))

Server part

shinyServer(function(input, output) {

  output$selectProgram <- renderUI({

    programs <- unique(as.character(ds$Program))
    checkboxGroupInput("Programs", "Choose programs",
                       choices  = programs,
                       selected = programs)
  })
  #...
  output$plot <- renderPlot({
    programs <- input$Programs
    types <- input$Types

    dsTemp <- ds %>% filter(TypeOfRealisation %in% types,
                            Program %in% programs)
    ggplot(dsTemp, aes(x=Year,y=nbAppart, group=Program)) + 
      geom_col(aes(fill=Program)) + 
      facet_wrap(.~TypeOfRealisation) + 
      theme_minimal() + 
      ggtitle(label = "Number of financed social apppartments in Paris",
              subtitle = "Week 3 course project by Grigory Sharkov. 29/08/2018") + 
      ylab("Number of appartments")
  })
})