#Sys.setlocale(locale = "Turkish_Turkey.1254")
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(knitr)
## Warning: package 'knitr' was built under R version 3.4.2
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.4.2
setwd("C:/Users/ahmetozmen/Desktop/MEF/BDA503/Group")
getwd()
## [1] "C:/Users/ahmetozmen/Desktop/MEF/BDA503/Group"
load("osym_data_2017.RData")
print("Osym data columns")
## [1] "Osym data columns"
ls(osym_data_2017)
##  [1] "city"              "exam_type"         "faculty_name"     
##  [4] "general_placement" "general_quota"     "max_score"        
##  [7] "min_score"         "program_id"        "program_name"     
## [10] "university_name"   "val_max_score"     "val_min_score"    
## [13] "val_placement"     "val_quota"
print("Osym data row number")
## [1] "Osym data row number"
nrow(osym_data_2017)
## [1] 11031
osym_data_2017$range<-osym_data_2017$max_score-osym_data_2017$min_score
kable(osym_data_2017[1:5,])
program_id university_name city faculty_name program_name exam_type general_quota general_placement min_score max_score val_quota val_placement val_min_score val_max_score range
100110266 ABANT IZZET BAYSAL ƜNIVERSITESI BOLU Bolu Saglik YĆ¼ksekokulu Hemsirelik YGS_2 150 150 328.8790 376.3817 4 4 312.8462 328.0626 47.50275
100110487 ABANT IZZET BAYSAL ƜNIVERSITESI BOLU Bolu Turizm Isletmeciligi ve Otelcilik YĆ¼ksekokulu Gastronomi ve Mutfak Sanatlari YGS_4 60 60 346.4491 388.3141 2 2 293.6994 328.7560 41.86493
100110724 ABANT IZZET BAYSAL ƜNIVERSITESI BOLU Bolu Turizm Isletmeciligi ve Otelcilik YĆ¼ksekokulu Turizm Isletmeciligi YGS_6 60 62 225.7170 290.2683 2 0 180.0000 180.0000 64.55139
100130252 ABANT IZZET BAYSAL ƜNIVERSITESI BOLU Bolu Turizm Isletmeciligi ve Otelcilik YĆ¼ksekokulu Turizm Isletmeciligi (IƖ) YGS_6 60 26 199.2710 234.9510 2 0 180.0000 180.0000 35.67996
100110433 ABANT IZZET BAYSAL ƜNIVERSITESI BOLU Dis Hekimligi FakĆ¼ltesi Dis Hekimligi MF_3 80 80 446.4848 451.5409 2 2 437.3683 442.9129 5.05614
osym_data_2017 %>% group_by(exam_type) %>%  summarise(quota=sum(general_quota),placement=sum(general_placement) , Doluluk=round(sum(general_placement)/sum(general_quota),2))
## # A tibble: 19 x 4
##    exam_type  quota placement Doluluk
##        <chr>  <int>     <int>   <dbl>
##  1     DIL_1  14934     14807    0.99
##  2     DIL_2    675       668    0.99
##  3     DIL_3   3297      3112    0.94
##  4        MF    130       134    1.03
##  5      MF_1  12697     10571    0.83
##  6      MF_2  12012     10780    0.90
##  7      MF_3  45841     44783    0.98
##  8      MF_4  88794     79908    0.90
##  9      TM_1 110886     61372    0.55
## 10      TM_2   6854      6009    0.88
## 11      TM_3  97384     75264    0.77
## 12      TS_1  34126     33227    0.97
## 13      TS_2  54107     51450    0.95
## 14     YGS_1    826       639    0.77
## 15     YGS_2   9382      8671    0.92
## 16     YGS_3     20        20    1.00
## 17     YGS_4   1441      1417    0.98
## 18     YGS_5   1979      1775    0.90
## 19     YGS_6  12803     10661    0.83

Score Type and occupancy rate at Mef University :

osym_data_2017 %>%  filter(substr(program_id,1,4)=="2072") %>% group_by(exam_type) %>%  summarise(quota=sum(general_quota),placement=sum(general_placement) , Doluluk=round(sum(general_placement)/sum(general_quota),2))
## # A tibble: 5 x 4
##   exam_type quota placement Doluluk
##       <chr> <int>     <int>   <dbl>
## 1     DIL_1    40        40    1.00
## 2      MF_1    20        20    1.00
## 3      MF_4   327       327    1.00
## 4      TM_1    80        66    0.82
## 5      TM_3   350       315    0.90

Top Quota by City

osym_data_2017 %>% group_by(city) %>%  summarise(quota=sum(general_quota)) %>% arrange(desc(quota))
## # A tibble: 97 x 2
##         city quota
##        <chr> <int>
##  1  ISTANBUL 97322
##  2 ESKISEHIR 59809
##  3    ANKARA 35745
##  4     IZMIR 18301
##  5     KONYA 16240
##  6   ERZURUM 14041
##  7   ANTALYA  8833
##  8   TRABZON  7865
##  9   KAYSERI  7683
## 10   ISPARTA  7253
## # ... with 87 more rows

Top Placement by University

osym_data_2017 %>% group_by(university_name) %>%  summarise(placement=sum(general_placement)) %>% arrange(desc(placement))
## # A tibble: 200 x 2
##                  university_name placement
##                            <chr>     <int>
##  1         ISTANBUL ƜNIVERSITESI     13194
##  2          ANADOLU ƜNIVERSITESI     12864
##  3          ATATƜRK ƜNIVERSITESI      9320
##  4           SELƇUK ƜNIVERSITESI      8358
##  5      DOKUZ EYLƜL ƜNIVERSITESI      7621
##  6             GAZI ƜNIVERSITESI      7497
##  7          SAKARYA ƜNIVERSITESI      7149
##  8 SƜLEYMAN DEMIREL ƜNIVERSITESI      6895
##  9          ERCIYES ƜNIVERSITESI      6869
## 10          KOCAELI ƜNIVERSITESI      6752
## # ... with 190 more rows

Top Placement by Program

osym_data_2017 %>% group_by(program_name) %>%  summarise(placement=sum(general_placement)) %>% arrange(desc(placement))
## # A tibble: 2,151 x 2
##              program_name placement
##                     <chr>     <int>
##  1             Hemsirelik     10835
##  2               Ilahiyat      8805
##  3                    Tip      8655
##  4                  Hukuk      7390
##  5                Isletme      7036
##  6                Iktisat      6910
##  7                  Tarih      5842
##  8 TĆ¼rk Dili ve Edebiyati      5787
##  9    Insaat MĆ¼hendisligi      4997
## 10     Sinif Ɩgretmenligi      4908
## # ... with 2,141 more rows

Hight avereage based on min_score by University

osym_data_2017 %>% group_by(university_name) %>%  summarise(score=mean(min_score)) %>% arrange(desc(score))
## # A tibble: 200 x 2
##                           university_name    score
##                                     <chr>    <dbl>
##  1               GALATASARAY ƜNIVERSITESI 456.1192
##  2                       KOƇ ƜNIVERSITESI 453.9176
##  3            AZERBAYCAN TIP ƜNIVERSITESI 437.8358
##  4                  BOGAZIƇI ƜNIVERSITESI 435.3811
##  5                IBN HALDUN ƜNIVERSITESI 422.3635
##  6              ABDULLAH GƜL ƜNIVERSITESI 412.3217
##  7                   SABANCI ƜNIVERSITESI 410.4619
##  8 TOBB EKONOMI VE TEKNOLOJI ƜNIVERSITESI 400.5025
##  9   IHSAN DOGRAMACI BILKENT ƜNIVERSITESI 397.4789
## 10          SAGLIK BILIMLERI ƜNIVERSITESI 394.8102
## # ... with 190 more rows

The relationship between general_quota and min_score

ggplot(osym_data_2017, aes(general_quota, max_score)) + geom_point() +  xlim(c(10, 200))
## Warning: Removed 2879 rows containing missing values (geom_point).

The relationship between general_quota and range

ggplot(osym_data_2017, aes(general_quota, range)) + geom_point() +  xlim(c(10, 200))
## Warning: Removed 2879 rows containing missing values (geom_point).

General Placement by Faculty Type

#substr(osym_data_2017$faculty_name, nchar(osym_data_2017$faculty_name)-10,nchar(osym_data_2017$faculty_name))
osym_data_2017$faculty_type <- ifelse (substr(osym_data_2017$faculty_name, nchar(osym_data_2017$faculty_name)-10,nchar(osym_data_2017$faculty_name))=="YĆ¼ksekokulu", "YĆ¼ksek Okul" , "Fakulte" )

bp<- ggplot(osym_data_2017, aes(x="", y=general_placement, fill=faculty_type))+
geom_bar(width = 1, stat = "identity",fun.y = "sum")
## Warning: Ignoring unknown parameters: fun.y
pie <- bp + coord_polar("y", start=0) 
pie