l wanted to analyze the Departing visitors of Turkey.l wanted to analyze the reasons of departures and the coutries that passengers travel from Turkey. I downloaded the data from Turkish Statistical Institute.
l downloaded the dataset from my files. Then l downloaded the packages tidyverse & dplyr.
install.packages(c("tidyverse"),repos="https://cran.r-project.org")
## package 'tidyverse' successfully unpacked and MD5 sums checked
##
## The downloaded binary packages are in
## C:\Users\bengisu.oniz\AppData\Local\Temp\Rtmp0AOYHD\downloaded_packages
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library("tidyverse")
## Loading tidyverse: ggplot2
## Loading tidyverse: tibble
## Loading tidyverse: tidyr
## Loading tidyverse: readr
## Loading tidyverse: purrr
## Conflicts with tidy packages ----------------------------------------------
## filter(): dplyr, stats
## lag(): dplyr, stats
library("readxl")
setwd("C:/Users/bengisu.oniz/Documents")
turizmverileriexx<-read_excel("turizmverileriexx.xlsx",sheet=1)
I wanted to see how my data looks like l used
str(turizmverileriexx)
## Classes 'tbl_df', 'tbl' and 'data.frame': 284 obs. of 3 variables:
## $ ulkeler : chr "ABD" "ABD" "ABD" "ABD" ...
## $ sebepler : chr "Akraba Ve Arkadaş Ziyareti" "Alışveriş" "Dini/Hac" "Diğer" ...
## $ kisi_sayisi: num 53714 2085 1269 2216 1718 ...
head(turizmverileriexx)
## # A tibble: 6 x 3
## ulkeler sebepler kisi_sayisi
## <chr> <chr> <dbl>
## 1 ABD Akraba Ve ArkadaÅŸ Ziyareti 53714
## 2 ABD Alışveriş 2085
## 3 ABD Dini/Hac 1269
## 4 ABD DiÄŸer 2216
## 5 ABD Eğitim Staj (1 Yıldan Az, Kendisi Tarafından Ödenen) 1718
## 6 ABD Gezi, Eğlence, Sportif Ve Kültürel Faaliyetler 320243
The countries that passengers visited.
totalpassengers<- turizmverileriexx %>% group_by(ulkeler) %>% summarise(toplam = sum(kisi_sayisi))
arrangedtotalpassengers <- totalpassengers %>% arrange(desc(toplam))
filtertotalpassengers <- arrangedtotalpassengers %>% filter(ulkeler != "Türkiye" & ulkeler != "Ölçüm") %>% slice(1:10)
ggplot(data=filtertotalpassengers, aes(x=ulkeler, y=toplam)) +
geom_bar(stat="identity",fill="blue")
The reasons that passengers’ arrivals
reasons<-turizmverileriexx %>% group_by(sebepler) %>% summarise(kisi_sayisi=sum(kisi_sayisi))
print(reasons)
## # A tibble: 10 x 2
## sebepler kisi_sayisi
## <chr> <dbl>
## 1 Akraba Ve ArkadaÅŸ Ziyareti 7031921
## 2 Alışveriş 1237626
## 3 DiÄŸer 1231627
## 4 Dini/Hac 47328
## 5 Eğitim Staj (1 Yıldan Az, Kendisi Tarafından Ödenen) 101142
## 6 Gezi, Eğlence, Sportif Ve Kültürel Faaliyetler 15287343
## 7 İş Amaçlı (Eğitim, Toplantı, Görev Vb.) 1751500
## 8 Sağlık Ve Tıbbi Nedenler (1 Yıldan Az) 377383
## 9 Transit 29530
## 10 <NA> 31365330
ggplot(data=reasons, aes(x=sebepler, y=kisi_sayisi)) +
geom_bar(stat="identity",fill="red")
The countries that passengers travel for education.
filtereducation<-turizmverileriexx %>% filter(sebepler=="Eğitim Staj (1 Yıldan Az, Kendisi Tarafından Ödenen)"& ulkeler != "Türkiye")%>%arrange(desc(kisi_sayisi))
ggplot(data=filtereducation, aes(x=ulkeler, y=kisi_sayisi)) +
geom_bar(stat="identity",fill="purple")
The reasons that passengers travel to Germany from Turkey.
germanydata<-turizmverileriexx %>% filter(ulkeler=="Almanya")%>%arrange(desc(kisi_sayisi))
ggplot(germanydata, aes(sebepler, kisi_sayisi)) +
geom_bar(stat = "identity",fill="darkgreen") +
coord_flip()