Importing & Organizing Data

The data have been collected data from BKM website.The data set has imported to R through the “read_html” function.

library(dplyr)
library(rvest)
library(tidyverse)
library(data.table)
library(openxlsx)
library(readxl)
library(tidyr)
library(scales)

#taking links from "https://bkm.com.tr" for every period.
X=c()

for (i in c(1:12)) {
  for (k in c(2010:2018)){
    month=i
    year=k
    date=paste(paste(paste("https://bkm.com.tr/secilen-aya-ait-sektorel-gelisim/?filter_year=",year,sep=""),"&filter_month=",month,sep=""),
               "&List=Listele",sep="")
    X=append(X, date)
  }
}

#for adding year and month columns.
year=c()

i=2010
k=1
while (i<=2018){
  year=append(year,i)
  print(year[k])
  i=i+1
  k=k+1
}

month=c()
i=1
k=1
while (i<=12){
  month=append(month,i)
  print(month[k])
  i=i+1
  k=k+1
}

Tarih <- crossing(month, year)

#importing HTMLs.
Y<-lapply(X, read_html)


#merging files and adding year and month coulmns.

df=data.frame()
for (i in c(1:length(Y))){
  A<-html_table(Y[[i]],header = FALSE, trim = TRUE, fill = TRUE, dec="") [4][[1]][-(1:2),]
  A<- A %>% mutate(Yıl=Tarih$year[i], Ay=Tarih$month[i])
  df=bind_rows(df,A)
}

#NAs introduced by coercion sorununu çözmek için.
df$X2=as.numeric(gsub("\\.","",df$X2))
df$X3=as.numeric(gsub("\\.","",df$X3))


A=gsub("\\.","",df$X4)
df$X4=as.numeric(gsub("\\,",".",A))

B=gsub("\\.","",df$X5)
df$X5=as.numeric(gsub("\\,",".",B))

df_new <- df


#tidying data
colnames(df_new)=c("Isyeri_Grubu","KK_Islem_Adedi","BK_Islem_Adedi","KK_Islem_Tutari","BK_Islem_Tutari","Yil","Ay")

df_new <- df_new %>% filter(`Isyeri_Grubu`!= "TOPLAM") 

Analysis & Graphs

Credit Card and Debit Card Transaction Amount

It can be seen from the “Kredi Karti ve Banka Islem Tutari (TL)” graph, from 2010 to 2018 credit card usage amount increased by 239,6% and debit card usage amount increased by 1.212,1%.

The share of debit card transaction amount in total was 8,9%, while the share of credit card transaction amount was 91,1%.

Credit Card Transaction Amount by Sector

When the credit card transaction amounts are analyzed on a sectoral basis, it is seen that market, fuel, clothing and electronic goods expenditures are at the forefront.

As can be seen from the “Sektor Bazinda Kredi Karti Islem Tutari (TL)” graph, that the amount of payment made by credit card in the places offering drinks, car rental services and social service expenditures is well below the average.

Credit Card and Debit Card Transaction Amount for Market

When the total amount of credit and debit card expenditures between 2010 and 2018 is analyzed, it is seen that markets stand out with a share of 17.6%.

Bank and credit card usage rates of markets and shopping centers are given in the “Market ve AVM Kredi Karti / Banka Kartı Islem Tutari (TL)” graph.