library(dplyr)
library(ggplot2)
library(plotly)
library(readxl)
konutdf <- read_xlsx("EVDS_istanbul_property_data.xlsx",
skip = 1,
n_max=131,
col_names=c('Month','TotalSales','EncumberedSales','NewHouseSales',
'UsedSales','SalestoForeigns','NewHousePriceIndex',
'HousePriceIndex','HouseUnitPriceTRY'))
usdf <- read_excel("USDbyMonth.xlsx")
konutdf <- konutdf %>% left_join(usdf, by="Month") %>% mutate("HouseUnitPriceUSD" = HouseUnitPriceTRY/MeanUSDTRY)
konutdf$Month <- konutdf$Month %>% readr::parse_date(format = "%Y-%m") %>% lubridate::as_date(.)
glimpse(konutdf)
## Rows: 129
## Columns: 11
## $ Month <date> 2010-01-01, 2010-02-01, 2010-03-01, 2010-04-01, 2…
## $ TotalSales <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ EncumberedSales <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ NewHouseSales <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ UsedSales <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ SalestoForeigns <dbl> NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA…
## $ NewHousePriceIndex <dbl> 35.9, 36.6, 37.4, 38.0, 38.0, 37.6, 37.3, 38.1, 38…
## $ HousePriceIndex <dbl> 36.0, 36.2, 36.5, 36.9, 37.1, 37.0, 37.2, 37.3, 37…
## $ HouseUnitPriceTRY <dbl> 1414.9, 1420.1, 1427.9, 1442.7, 1449.0, 1445.4, 14…
## $ MeanUSDTRY <dbl> 1.4690, 1.5095, 1.5280, 1.4865, 1.5353, 1.5699, 1.…
## $ HouseUnitPriceUSD <dbl> 963.1722, 940.7751, 934.4895, 970.5348, 943.7895, …
a <- ggplot(data = konutdf, aes(x = Month)) +
geom_line(aes(y = HouseUnitPriceTRY), color = "darkred", group=1) +
geom_line(aes(y = HouseUnitPriceUSD*4), color="steelblue", group=1) +
scale_y_continuous(
# Features of the first axis
name = "Mean House Price per m2 TRY",
# Add a second axis and specify its features
sec.axis = sec_axis(~./4,name="Mean House Price per m2 USD")
) +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=90, size=8)) +
scale_x_date(date_breaks = "6 month",date_labels = "%b %Y")
a
after2013 <- konutdf %>% tail(93)
ggplot(data = after2013, aes(x = Month)) +
geom_bar(aes(y = SalestoForeigns), fill = "darkred", stat = "identity") +
geom_line(aes(y = HouseUnitPriceUSD*2), color="steelblue", group=1) +
scale_y_continuous(
# Features of the first axis
name = "Sales to Foreigns (Count) ",
# Add a second axis and specify its features
sec.axis = sec_axis(~./2,name="Mean House Price per m2 (USD)")
) +
theme(panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
axis.text.x = element_text(angle=90, size=8)) +
scale_x_date(date_breaks = "6 month",date_labels = "%b %Y")
Mean price per m2 in TRY usually increases but mean price per m2 in USD draws a wavy graphic.
House sales to foreigners increased with the decrease in the dollar exchange rate and mean house price per m2 in USD. Especially after price per m2 in USD falling below $ 1000, there was a big increase in sales to foreigners because of exchange rate.