Data

<>

Datasets shown below downloaded from Istanbul Metropolitan Municipality website as csv and xlsx files. Separate links are also provided.

Data Sets

  1. Earthquake Scenario Analysis Results

    In this dataset some column names has been changed. Structure and first 10 observation can be seen below. Download R.Data file to see the entire dataframe.

    Show the code
    library(dplyr)
    library(readr)
    library(knitr)
    deprem_analiz <- read.csv("Deprem_senaryosu_analiz_sonuçlar.csv")
    deprem_analiz$ilce_adi <- gsub("Ý", "İ", deprem_analiz$ilce_adi, fixed = TRUE)
    deprem_analiz$ilce_adi <- gsub("Ð", "Ğ", deprem_analiz$ilce_adi, fixed = TRUE)
    deprem_analiz$ilce_adi <- gsub("Þ", "Ş", deprem_analiz$ilce_adi, fixed = TRUE)
    deprem_analiz$ilce_adi <- gsub("Þ", "Ş", deprem_analiz$ilce_adi, fixed = TRUE)
    
    colnames(deprem_analiz)[1:4] <- c("id", "ilce_adi", "mahalle_adi", "mahalle_kodu")
    kable(str(deprem_analiz), caption="Structure of deprem_analiz")
    'data.frame':   959 obs. of  16 variables:
     $ id                          : int  1 2 3 4 5 6 7 8 9 10 ...
     $ ilce_adi                    : chr  "ADALAR" "ADALAR" "ADALAR" "ADALAR" ...
     $ mahalle_adi                 : chr  "BURGAZADA" "HEYBELÝADA" "KINALIADA" "MADEN" ...
     $ mahalle_kodu                : int  40139 40142 40143 40140 40141 40490 99359 40478 40482 191981 ...
     $ cok_agir_hasarli_bina_sayisi: int  54 101 53 104 101 1 2 1 1 1 ...
     $ agir_hasarli_bina_sayisi    : int  99 175 97 192 180 3 13 6 6 5 ...
     $ orta_hasarli_bina_sayisi    : int  256 423 287 483 445 21 108 51 49 23 ...
     $ hafif_hasarli_bina_sayisi   : int  241 393 302 484 422 57 371 199 129 65 ...
     $ can_kaybi_sayisi            : int  8 25 5 22 16 0 0 0 0 0 ...
     $ agir_yarali_sayisi          : int  6 21 3 18 13 0 0 0 0 0 ...
     $ hastanede_tedavi_sayisi     : int  24 66 15 64 48 1 8 2 2 0 ...
     $ hafif_yarali_sayisi         : int  42 113 27 113 83 3 26 10 8 0 ...
     $ dogalgaz_boru_hasari        : int  0 1 0 1 1 0 1 0 0 0 ...
     $ icme_suyu_boru_hasari       : int  0 1 1 1 2 0 1 1 0 0 ...
     $ atik_su_boru_hasari         : int  1 2 1 2 2 0 1 1 0 0 ...
     $ gecici_barinma              : int  398 763 420 847 687 89 659 273 209 26 ...

    Table: Structure of deprem_analiz

    Show the code
    save(deprem_analiz, file = "deprem_analiz.RData")
  2. Neighborhood-Based Building Numbers in 2017

    toplam_bina column is calculated and added to the last. Also, some colum names has been changed.

    Show the code
    mahalle_bazli_bina <- read.csv("mahalle_bazli_bina_2017.csv")
    colnames(mahalle_bazli_bina) <- c("id", "ilce_adi", "mahalle_adi", "mahalle_kodu", "once_1980", "ara_1980_2000", "sonra_2000", "ara_1_4_kat", "ara_5_9_kat", "ara_9_19_kat")
    
    mahalle_bazli_bina$ilce_adi <- gsub("Ý", "İ", deprem_analiz$ilce_adi, fixed = TRUE)
    mahalle_bazli_bina$ilce_adi <- gsub("Ð", "Ğ", deprem_analiz$ilce_adi, fixed = TRUE)
    mahalle_bazli_bina$ilce_adi <- gsub("Þ", "Ş", deprem_analiz$ilce_adi, fixed = TRUE)
    mahalle_bazli_bina$ilce_adi <- gsub("Þ", "Ş", deprem_analiz$ilce_adi, fixed = TRUE)
    
    mahalle_bazli_bina$mahalle_adi <- gsub("Ý", "İ", deprem_analiz$ilce_adi, fixed = TRUE)
    mahalle_bazli_bina$mahalle_adi <- gsub("Ð", "Ğ", deprem_analiz$ilce_adi, fixed = TRUE)
    mahalle_bazli_bina$mahalle_adi <- gsub("Þ", "Ş", deprem_analiz$ilce_adi, fixed = TRUE)
    mahalle_bazli_bina$mahalle_adi <- gsub("Þ", "Ş", deprem_analiz$ilce_adi, fixed = TRUE)    
    
    toplam_bina <- mahalle_bazli_bina %>% 
      select(ara_1_4_kat,ara_5_9_kat,ara_9_19_kat) %>%
      rowwise() %>%
      do( (.) %>% as.data.frame() %>% mutate(toplam_bina = sum(.))) %>%
      ungroup %>%
      select(toplam_bina)
    mahalle_bazli_bina <- cbind(mahalle_bazli_bina, toplam_bina)
    str(mahalle_bazli_bina)
    'data.frame':   959 obs. of  11 variables:
     $ id           : int  1 2 3 4 5 6 7 8 9 10 ...
     $ ilce_adi     : chr  "ADALAR" "ADALAR" "ADALAR" "ADALAR" ...
     $ mahalle_adi  : chr  "ADALAR" "ADALAR" "ADALAR" "ADALAR" ...
     $ mahalle_kodu : int  40139 40142 40143 40140 40141 40490 99359 40478 40482 191981 ...
     $ once_1980    : int  433 836 610 863 842 0 0 0 0 0 ...
     $ ara_1980_2000: int  214 347 244 510 426 244 1360 685 565 332 ...
     $ sonra_2000   : int  173 212 158 308 217 121 845 589 216 184 ...
     $ ara_1_4_kat  : int  802 1359 923 1637 1434 353 1647 797 754 515 ...
     $ ara_5_9_kat  : int  18 36 89 44 51 12 555 470 27 1 ...
     $ ara_9_19_kat : int  0 0 0 0 0 0 3 7 0 0 ...
     $ toplam_bina  : int  820 1395 1012 1681 1485 365 2205 1274 781 516 ...
    Show the code
    kable(head(mahalle_bazli_bina, n = 10L), caption="Head of Mahalle Bazlı Bina")
    Head of Mahalle Bazlı Bina
    id ilce_adi mahalle_adi mahalle_kodu once_1980 ara_1980_2000 sonra_2000 ara_1_4_kat ara_5_9_kat ara_9_19_kat toplam_bina
    1 ADALAR ADALAR 40139 433 214 173 802 18 0 820
    2 ADALAR ADALAR 40142 836 347 212 1359 36 0 1395
    3 ADALAR ADALAR 40143 610 244 158 923 89 0 1012
    4 ADALAR ADALAR 40140 863 510 308 1637 44 0 1681
    5 ADALAR ADALAR 40141 842 426 217 1434 51 0 1485
    6 ARNAVUTKÖY ARNAVUTKÖY 40490 0 244 121 353 12 0 365
    7 ARNAVUTKÖY ARNAVUTKÖY 99359 0 1360 845 1647 555 3 2205
    8 ARNAVUTKÖY ARNAVUTKÖY 40478 0 685 589 797 470 7 1274
    9 ARNAVUTKÖY ARNAVUTKÖY 40482 0 565 216 754 27 0 781
    10 ARNAVUTKÖY ARNAVUTKÖY 191981 0 332 184 515 1 0 516

    A new column has been created to examine buildings in districts separately. You can see the first 10 district that have highest number of buildings.

    Show the code
    kable(mahalle_bazli_bina %>% 
      group_by(ilce_adi) %>%
      summarize(ilce_bazli_bina = sum(toplam_bina)) %>%
      arrange(desc(ilce_bazli_bina)) %>%
      head(n = 10L))
    ilce_adi ilce_bazli_bina
    ÜMRANİYE 52612
    PENDİK 51491
    BEYKOZ 51201
    SİLİVRİ 50014
    SARIYER 49360
    FATİH 43560
    BAĞCILAR 42439
    ÜSKÜDAR 41731
    KÜÇÜKÇEKMECE 40136
    ESENYURT 38685
    Show the code
    save(mahalle_bazli_bina, file = "mahalle_bazli_bina.RData")

    Refer to R.Data file.

  3. Municipality Population in 2019

    Structure and first 10 observation can be seen below.

    Show the code
    library(readxl)
    nufus <- read_excel("belediye_nufuslar_2019.xlsx")
    str(nufus)
    tibble [39 × 2] (S3: tbl_df/tbl/data.frame)
     $ Belediyeler        : chr [1:39] "Adalar Belediyesi" "Arnavutköy Belediyesi" "Ataşehir Belediyesi" "Avcılar Belediyesi" ...
     $ 2019 yılı nüfusları: num [1:39] 15238 282488 425094 448882 745125 ...
    Show the code
    head(nufus, n = 30L)
    # A tibble: 30 × 2
       Belediyeler             `2019 yılı nüfusları`
       <chr>                                   <dbl>
     1 Adalar Belediyesi                       15238
     2 Arnavutköy Belediyesi                  282488
     3 Ataşehir Belediyesi                    425094
     4 Avcılar Belediyesi                     448882
     5 Bağcılar Belediyesi                    745125
     6 Bahçelievler Belediyesi                611059
     7 Bakırköy Belediyesi                    229239
     8 Başakşehir Belediyesi                  460259
     9 Bayrampaşa Belediyesi                  274735
    10 Beşiktaş Belediyesi                    182649
    # ℹ 20 more rows
    Show the code
    save(nufus, file = "nufus.RData")

    You can also download this dataset as R.Data file.

    An Overview

    Show the code
    library(ggplot2)
    vis <- deprem_analiz %>% 
      inner_join(mahalle_bazli_bina, by = "id") %>%
      select(ilce_adi.x, ara_1_4_kat, ara_5_9_kat, ara_9_19_kat, toplam_bina, can_kaybi_sayisi) 
    
    vis %>% ggplot(aes(x = toplam_bina, y = can_kaybi_sayisi, color = ilce_adi.x )) + geom_abline(slope = log10(10)/log10(100),intercept = 0) +
      scale_x_log10()+
      scale_y_log10()+
      geom_point()
    Warning: Transformation introduced infinite values in continuous y-axis

    The plot shown above shows us total loss vs total number of buildings.

    Show the code
    vis2 <- deprem_analiz %>% 
      inner_join(mahalle_bazli_bina, by = "id") %>%
      select(ilce_adi.x,once_1980, ara_1980_2000, sonra_2000, toplam_bina, can_kaybi_sayisi,toplam_bina) %>% 
      group_by(ilce_adi.x) %>%
      summarize(toplam_once_1980 = sum(once_1980), toplam_ara_1980_2000 = sum(ara_1980_2000), toplam_sonra_2000 = sum(sonra_2000))
    
    
    ggplot(vis2, aes(x = ilce_adi.x)) +
      geom_bar(aes(y = toplam_once_1980), stat = "identity", fill = "blue", position = "dodge") +
      geom_bar(aes(y = toplam_ara_1980_2000), stat = "identity", fill = "green", position = "dodge") +
      geom_bar(aes(y = toplam_sonra_2000), stat = "identity", fill = "red", position = "dodge") +
      labs(title = "Toplam Değerler - İlçelere Göre", x = "İlçe Adı", y = "Toplam Değer") +
      scale_fill_manual(values = c("Once 1980" = "blue", "Ara 1980-2000" = "green", "Sonra 2000" = "red"),
                        name = "Zaman Aralığı",
                        labels = c("Once 1980", "Ara 1980-2000", "Sonra 2000")) +
      theme_minimal() +
      theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.5))+
      guides(fill = guide_legend(title = "Zaman Aralığı"))

    This plot shows us total building for each time zone vs district.

    Note: blue –> before 1980, green –> between 1980 - 2000, red –> after 2000.

Back to top