library(scales)
library(grid)
library(tidyverse)
library(lubridate)
library(stringr)
library(ggplot2)
library(naniar)
library(readxl)
library(reshape2)
library(ggthemes)
df<-read_xlsx(file.choose(),n_max = 130)
df$Tarih<-paste0(df$Tarih,as.character("-01"))
df$Tarih<-as.Date(df$Tarih, format="%Y-%m-%d")
df<-rename(df,Tarih=Tarih,
Sifir_ikinciEl_Satilan_Konut=`TP AKONUTSAT1 T40`,
Ipotekli_Satilan_Konut= `TP AKONUTSAT2 T40`,
Sifir_Satilan_Konut=`TP AKONUTSAT3 T40`,
Ikinci_El_Satilan_Konut=`TP AKONUTSAT4 T40`,
Yabanciya_Satilan_Konut=`TP DISKONSAT ISTANBUL`,
YeniKonut_Fiyat_Endeks=`TP HEDONIKYKFE IST`,
Istanbul_TR10=`TP HKFE02`,
M2_Fiyati=`TP TCBF02 ISTANBUL`)
Tarih: Date Column
Sifir_ikinciEl_Satilan_Konut: Pre-owned Housing + New Housing total sold quantity in Istanbul Ipotekli_Satilan_Konut : Servient Houising sold quantity in Istanbul Sifir_Satilan_Konut : New Housing sold quantity in Istanbul Ikinci_El_Satilan_Konut : Pre-Owned Housing sold quantity in Istanbul Yabanciya_Satilan_Konut : Housing Sold Quantity to non-Turkish Citizen in Istanbul YeniKonut_Fiyat_Endeks : New Housing Price Index in Istanbul Istanbul_TR10 : Istanbul TR10 region housing price index in Istanbul M2_Fiyati : Square metre price in Istanbul
str(df)
## tibble [129 x 9] (S3: tbl_df/tbl/data.frame)
## $ Tarih : Date[1:129], format: "2010-01-01" "2010-02-01" ...
## $ Sifir_ikinciEl_Satilan_Konut: num [1:129] NA NA NA NA NA NA NA NA NA NA ...
## $ Ipotekli_Satilan_Konut : num [1:129] NA NA NA NA NA NA NA NA NA NA ...
## $ Sifir_Satilan_Konut : num [1:129] NA NA NA NA NA NA NA NA NA NA ...
## $ Ikinci_El_Satilan_Konut : num [1:129] NA NA NA NA NA NA NA NA NA NA ...
## $ Yabanciya_Satilan_Konut : num [1:129] NA NA NA NA NA NA NA NA NA NA ...
## $ YeniKonut_Fiyat_Endeks : num [1:129] 35.9 36.6 37.4 38 38 37.6 37.3 38.1 38.8 39.1 ...
## $ Istanbul_TR10 : num [1:129] 36 36.2 36.5 36.9 37.1 37 37.2 37.3 37.7 38.1 ...
## $ M2_Fiyati : num [1:129] 1415 1420 1428 1443 1449 ...
gg_miss_var(df)
Sum of Ikinci_El_Satilan_Konut and Sifir_Satilan_Konut made up Sifir_ikinciEl_Satilan_Konut values. So there is high correlation between those three columns. It can be easily state that between 2018 - 2020, while pre-owned selling house quantity has been increasing significantly, selling new home quantity has been fallen almost 40.000 during two years. Square meter price has aggresively risen threefold from 2013 to 2020. Finally, Housing sold quantity to Foreign citizens has reached at peak in 2019. However, in 2020 it has fallen by approximately 7.000 housing quantity.
annual_df <- df%>%
group_by(Year=year(Tarih)) %>%
summarise_if(is.numeric, sum, na.rm = FALSE)
annual_df
## # A tibble: 11 x 9
## Year Sifir_ikinciEl_~ Ipotekli_Satila~ Sifir_Satilan_K~ Ikinci_El_Satil~
## <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 2010 NA NA NA NA
## 2 2011 NA NA NA NA
## 3 2012 NA NA NA NA
## 4 2013 234789 106977 103853 130936
## 5 2014 225454 87757 102936 122518
## 6 2015 239767 93564 112491 127276
## 7 2016 232428 87350 110324 122104
## 8 2017 238383 87001 114732 123651
## 9 2018 234055 49206 111230 122825
## 10 2019 237675 55819 92381 145294
## 11 2020 201434 90421 58816 142618
## # ... with 4 more variables: Yabanciya_Satilan_Konut <dbl>,
## # YeniKonut_Fiyat_Endeks <dbl>, Istanbul_TR10 <dbl>, M2_Fiyati <dbl>
df_pivot<-pivot_longer(annual_df,!Year)
print(df_pivot, n=15)
## # A tibble: 88 x 3
## Year name value
## <dbl> <chr> <dbl>
## 1 2010 Sifir_ikinciEl_Satilan_Konut NA
## 2 2010 Ipotekli_Satilan_Konut NA
## 3 2010 Sifir_Satilan_Konut NA
## 4 2010 Ikinci_El_Satilan_Konut NA
## 5 2010 Yabanciya_Satilan_Konut NA
## 6 2010 YeniKonut_Fiyat_Endeks 457.
## 7 2010 Istanbul_TR10 447.
## 8 2010 M2_Fiyati 17542.
## 9 2011 Sifir_ikinciEl_Satilan_Konut NA
## 10 2011 Ipotekli_Satilan_Konut NA
## 11 2011 Sifir_Satilan_Konut NA
## 12 2011 Ikinci_El_Satilan_Konut NA
## 13 2011 Yabanciya_Satilan_Konut NA
## 14 2011 YeniKonut_Fiyat_Endeks 494.
## 15 2011 Istanbul_TR10 488.
## # ... with 73 more rows
ggplot(df_pivot)+geom_line(aes(x=Year,y=value,linetype = "dotted",size=1.25))+ facet_wrap(~name,scales="free")+
scale_linetype_manual(values = 'dotted',guide = "none")+
scale_x_continuous(breaks=seq(2013,2020,by=1))+scale_y_continuous(labels=scales::comma)+ theme_wsj()+
coord_cartesian(xlim = c(2013,2020))+
theme( plot.title = element_text(face = "italic", size = 40, margin=margin(0,0,50,0)),
legend.position="none",axis.text.x = element_text(angle=60,hjust=1,vjust=1,size=25),
axis.title.x=element_text(size=35,margin=margin(50,0,0,0)),
axis.text.y = element_text(size=25),
strip.text = element_text(size=25,color="grey25"),
axis.title.y=element_text(size=35, margin=margin(30,0,100,0)),
panel.spacing = unit(3, "lines"))+
labs(title="Housing Metric Change Over Years In Istanbul",x ="Years", y = "Values")
## Warning: Removed 4 row(s) containing missing values (geom_path).