Show the code
library(tidyverse)
library(dplyr)
library(readxl)
library(lubridate)
library(tidyr)
library(zoo)
library(janitor)
library(reactable)
library(data.table)
library(ggplot2)
library(tidyverse)
library(dplyr)
library(readxl)
library(lubridate)
library(tidyr)
library(zoo)
library(janitor)
library(reactable)
library(data.table)
library(ggplot2)
We are importing construction cost index, Turnover rate, usd to tl exchange rate, House sales to foreigners, House Sales by Province data sets.
<- readRDS("Datards/ConsIndex.rds")
ConsIndex <- readRDS("Datards/Turnover.rds")
Turnover <- readRDS("Datards/House_sales_to_foreigners_month.rds")
House_sales_to_foreigners_month <- readRDS("Datards/House_sales_to_foreigners_year.rds")
House_sales_to_foreigners_year
<- read_excel("data/monthly_usd_to_try.xls")
monthly_usd_to_try $month <- as.Date(monthly_usd_to_try$month)
monthly_usd_to_try$month <- format(monthly_usd_to_try$month,"%Y-%b-%d")
monthly_usd_to_try
<- "data/House Sales by Provinces.xls"
PATH <- read_excel(PATH, range = cell_rows(14:129), col_names = names(read_excel(PATH, skip = 2)))
house_sales_by_provinces
<- aggregate(house_sales_by_provinces[3], house_sales_by_provinces[1], FUN=sum)
total_sales_by_year
<- read_excel("data/House sales to foreigners.xls",
House_sales_to_foreigners_month sheet = "Month")
$Month <- match(House_sales_to_foreigners_month$Month, month.name)
House_sales_to_foreigners_month
$Date <- as.yearmon(paste(House_sales_to_foreigners_month$Year, House_sales_to_foreigners_month$Month), "%Y %m") House_sales_to_foreigners_month
<- read_excel("data/monthly_usd_to_try.xls")
monthly_usd_to_try
$month <- as.Date(monthly_usd_to_try$month)
monthly_usd_to_trycolnames(monthly_usd_to_try) <- c("date","value")
ggplot(data=monthly_usd_to_try, aes(x=date, y=value, group=1)) +
geom_line()+
geom_point()
<- read_excel("data/construction_cost_index_by_industries_and_cost_groups_preprocessed.xls")
construction_cost_index
$date <- as.Date(construction_cost_index$date)
construction_cost_indexcolnames(construction_cost_index) <- c("date","cost_type","value","material","labour")
= construction_cost_index %>%
cost_index filter(cost_type=="construction") %>%
group_by(date) %>%
summarize(value=sum(value))
ggplot(data=cost_index, aes(x=date, y=value, group=1)) +
geom_line()+
geom_point()
After 2017, Iran overtakes Iraq. There is a high increase in Russia as we move from 2021 to 2022. We assume the reason is Ukraine - Russian war.
<- read_excel("data/HSTFBN.xls", sheet = "FOREIGNERS BY NATIONALITIES")
HSTFBN
<- HSTFBN %>% group_by(year,country) %>% filter(country %in% c("Russia","Iran", "Iraq")) %>% summarise(sum=sum(total)) total_sale_by_country
`summarise()` has grouped output by 'year'. You can override using the
`.groups` argument.
ggplot(data=total_sale_by_country,aes(x=year,y=sum,fill=country)) +
geom_bar(stat="identity",position = "dodge")
<- read_excel("data/house_sales_by_districts_preprocessed.xls")
house_sales_by_districts_preprocessed
<- house_sales_by_districts_preprocessed %>%
house_sales group_by(year) %>%
summarise(morgaged=sum(mortgaged), total=sum(total), first_hand=sum(first_hand), second_hand=sum(second_hand))
ggplot(data=house_sales,aes(x=year),group = 1 ) +
geom_line(aes(y=morgaged,color='morgaged')) +
geom_line(aes(y=total,color='total'))+
xlab("Year")+
ylab("Values")
<- read_excel("data/house_sales_by_districts_preprocessed.xls")
house_sales_by_districts_preprocessed
<- house_sales_by_districts_preprocessed %>%
house_sales group_by(year) %>%
summarise(morgaged=sum(mortgaged), total=sum(total), first_hand=sum(first_hand), second_hand=sum(second_hand))
ggplot(data=house_sales,aes(x=year),group = 1 ) +
geom_line(aes(y=first_hand,color='first_hand')) +
geom_line(aes(y=second_hand,color='second_hand')) +
xlab("Year")+
ylab("Values")
<- slice(house_sales_by_provinces %>%
annual_avg_hs group_by(house_sales_by_provinces[1]) %>%
summarize_if(is.numeric,sum,na.rm = TRUE), 1:(n()-1))[3:82] %>%
summarize_if(is.numeric,mean,na.rm = TRUE)
barplot(unlist(annual_avg_hs), col = rainbow(100), las=2, cex.names=.6, horiz = TRUE)