This is an individual in-class exercise. At the end of the exercise, please upload html outputs to your Progress Journals.

  1. Get the highest max_score programs from each exam_type.
load("D:\\Users\\SUUSER\\Desktop\\osym_data_2017_v2.RData")
osym_data_2017 %>% group_by(exam_type) %>% summarise(maxscore = max(max_score))
## # A tibble: 19 x 2
##    exam_type maxscore
##    <chr>        <dbl>
##  1 DİL_1          543
##  2 DİL_2          485
##  3 DİL_3          490
##  4 MF             408
##  5 MF_1           537
##  6 MF_2           527
##  7 MF_3           564
##  8 MF_4           575
##  9 TM_1           561
## 10 TM_2           458
## 11 TM_3           558
## 12 TS_1           527
## 13 TS_2           536
## 14 YGS_1          516
## 15 YGS_2          473
## 16 YGS_3          315
## 17 YGS_4          466
## 18 YGS_5          419
## 19 YGS_6          519
  1. Plot the top 10 programs of İSTANBUL ÜNİVERSİTESİ in terms of total quota in a bar chart.
osym_data_2017 <- osym_data_2017 %>% mutate(general_quota= as.numeric(general_quota), general_placement = as.numeric(general_placement))

top_10_iu <- osym_data_2017 %>% filter(university_name == "İSTANBUL ÜNİVERSİTESİ") %>% arrange(desc(general_quota)) %>% slice(1:10)
top_10_iu
## # A tibble: 10 x 14
##    program_id university_name  city   faculty_name  program_name exam_type
##    <chr>      <chr>            <chr>  <chr>         <chr>        <chr>    
##  1 105611289  İSTANBUL ÜNİVER~ İSTAN~ Açık ve Uzak~ Sosyoloji (~ TM_3     
##  2 105611298  İSTANBUL ÜNİVER~ İSTAN~ Açık ve Uzak~ İşletme (Aç~ TM_1     
##  3 105611183  İSTANBUL ÜNİVER~ İSTAN~ Açık ve Uzak~ Coğrafya (A~ TS_1     
##  4 105611305  İSTANBUL ÜNİVER~ İSTAN~ Açık ve Uzak~ Tarih (Açık~ TS_2     
##  5 105611314  İSTANBUL ÜNİVER~ İSTAN~ Açık ve Uzak~ İktisat (Aç~ TM_1     
##  6 105610501  İSTANBUL ÜNİVER~ İSTAN~ Hukuk Fakült~ Hukuk        TM_3     
##  7 105611174  İSTANBUL ÜNİVER~ İSTAN~ Açık ve Uzak~ Felsefe (Aç~ TM_3     
##  8 105630092  İSTANBUL ÜNİVER~ İSTAN~ Hukuk Fakült~ Hukuk (İÖ)   TM_3     
##  9 105610634  İSTANBUL ÜNİVER~ İSTAN~ İstanbul Tıp~ İstanbul Tıp MF_3     
## 10 105610016  İSTANBUL ÜNİVER~ İSTAN~ Cerrahpaşa T~ Cerrahpaşa ~ MF_3     
## # ... with 8 more variables: general_quota <dbl>, general_placement <dbl>,
## #   min_score <dbl>, max_score <dbl>, val_quota <dbl>,
## #   val_placement <dbl>, val_min_score <dbl>, val_max_score <dbl>
library(ggplot2)

ggplot(data=top_10_iu) + geom_bar(aes(x= reorder(program_name, - general_quota),
y=general_quota), stat="identity") + theme(axis.text.x = element_text(angle=90))                                       

  1. Calculate the fill rate (sum(general_placement)/sum(general_quota)) per city and return the top 10 cities.
osym_data_2017
## # A tibble: 11,465 x 14
##    program_id university_name  city  faculty_name  program_name  exam_type
##    <chr>      <chr>            <chr> <chr>         <chr>         <chr>    
##  1 100110266  ABANT İZZET BAY~ BOLU  Bolu Sağlık ~ Hemşirelik    YGS_2    
##  2 100110487  ABANT İZZET BAY~ BOLU  Bolu Turizm ~ Gastronomi v~ YGS_4    
##  3 100110724  ABANT İZZET BAY~ BOLU  Bolu Turizm ~ Turizm İşlet~ YGS_6    
##  4 100130252  ABANT İZZET BAY~ BOLU  Bolu Turizm ~ Turizm İşlet~ YGS_6    
##  5 100110433  ABANT İZZET BAY~ BOLU  Diş Hekimliğ~ Diş Hekimliği MF_3     
##  6 100110609  ABANT İZZET BAY~ BOLU  Diş Hekimliğ~ Diş Hekimliğ~ MF_3     
##  7 100110018  ABANT İZZET BAY~ BOLU  Eğitim Fakül~ Bilgisayar v~ MF_1     
##  8 100110027  ABANT İZZET BAY~ BOLU  Eğitim Fakül~ Fen Bilgisi ~ MF_2     
##  9 100110036  ABANT İZZET BAY~ BOLU  Eğitim Fakül~ İlköğretim M~ MF_1     
## 10 100110045  ABANT İZZET BAY~ BOLU  Eğitim Fakül~ İngilizce Öğ~ DİL_1    
## # ... with 11,455 more rows, and 8 more variables: general_quota <dbl>,
## #   general_placement <dbl>, min_score <dbl>, max_score <dbl>,
## #   val_quota <dbl>, val_placement <dbl>, val_min_score <dbl>,
## #   val_max_score <dbl>
osym_data_2017 %>% group_by(city) %>% summarise(fillrate = sum(general_placement)/sum(general_quota)) %>% arrange(desc(fillrate)) %>% slice(1:10)
## # A tibble: 10 x 2
##    city                  fillrate
##    <chr>                    <dbl>
##  1 GEBZE                    1.02 
##  2 TEKİRDAĞ                 1.01 
##  3 MANİSA                   1.01 
##  4 KOCAELİ                  1.00 
##  5 BURSA                    1.00 
##  6 SUMGAYIT - AZERBAYCAN    1.00 
##  7 DİYARBAKIR               0.999
##  8 DENİZLİ                  0.998
##  9 EDİRNE                   0.998
## 10 SAKARYA                  0.997
  1. Find full (general_placement == general_quota) Endüstri Mühendisliği programs (use grepl) and draw a scatterplot of min_score vs max_score. Set transparency parameter (alpha) to 0.7. Set program colors according to whether it is a foundation university or state university. (Tip: State university programs ids start with 1, foundation 2, KKTC 3 and other abroad 4. You can use substr function.).
library(ggplot2)
fullieprograms <- osym_data_2017%>% select(program_id,university_name,program_name,general_quota,general_placement, min_score, max_score) %>% filter(program_name == "Endüstri Mühendisliği",general_quota==general_placement)
fullieprograms
## # A tibble: 15 x 7
##    program_id university_name  program_name general_quota general_placeme~
##    <chr>      <chr>            <chr>                <dbl>            <dbl>
##  1 101011032  ANADOLU ÜNİVERS~ Endüstri Mü~          65.0             65.0
##  2 102910297  ÇUKUROVA ÜNİVER~ Endüstri Mü~          60.0             60.0
##  3 103110478  DOKUZ EYLÜL ÜNİ~ Endüstri Mü~          90.0             90.0
##  4 103810198  ESKİŞEHİR OSMAN~ Endüstri Mü~          80.0             80.0
##  5 104010131  GALATASARAY ÜNİ~ Endüstri Mü~          25.0             25.0
##  6 104110642  GAZİ ÜNİVERSİTE~ Endüstri Mü~          90.0             90.0
##  7 105510292  İSTANBUL TEKNİK~ Endüstri Mü~          80.0             80.0
##  8 105610704  İSTANBUL ÜNİVER~ Endüstri Mü~          60.0             60.0
##  9 106210829  KARADENİZ TEKNİ~ Endüstri Mü~          60.0             60.0
## 10 106910337  KOCAELİ ÜNİVERS~ Endüstri Mü~          80.0             80.0
## 11 102510256  MANİSA CELÂL BA~ Endüstri Mü~          60.0             60.0
## 12 108210823  ONDOKUZ MAYIS Ü~ Endüstri Mü~          60.0             60.0
## 13 108810332  SAKARYA ÜNİVERS~ Endüstri Mü~         100              100  
## 14 109710321  ULUDAĞ ÜNİVERSİ~ Endüstri Mü~          60.0             60.0
## 15 110110225  YILDIZ TEKNİK Ü~ Endüstri Mü~          80.0             80.0
## # ... with 2 more variables: min_score <dbl>, max_score <dbl>
fullieprograms1<- fullieprograms %>% mutate(new_id = substr(program_id,1,1))
ggplot(data=fullieprograms1, aes(x=max_score, y=min_score, color= new_id)) + geom_point(alpha= .7)

  1. Find the top 10 faculties with the highest quotas and draw a bar chart. Ignore similar names and typos in faculty names.
question5 <- osym_data_2017 %>% arrange(desc(general_quota)) %>% slice(1:10)

ggplot(data=question5) + geom_bar(aes(x=reorder(program_name, -general_quota),y=general_quota), stat="identity") + theme(axis.text.x=element_text(angle=90,size = 8))

  1. Find all full medicine programs (Tıp but not Tıp Mühendisliği) of foundation universities group by university calculate total quotas per university and maximum max_score and minimum min_score as bounds, ordered and colored by total quota. (Tip: Use geom_crossbar)
TIP <- osym_data_2017 %>% filter(grepl("Tıp", program_name)) %>% filter(!grepl("Mühendis",program_name)) %>% filter(substr(program_id,1,1) == 1) %>% group_by(university_name) %>% summarize(total_quota = sum(general_quota), maximum_score = max(max_score),minimum_score = min(min_score) ) %>%ungroup() %>% arrange(desc(total_quota))
ggplot(data=TIP) + geom_crossbar(aes(x=reorder(university_name,-total_quota) , y = ((maximum_score+minimum_score)/2) , ymax= maximum_score , ymin = minimum_score , color = total_quota)) + labs (y = "Max and Min Scores") + theme(axis.text.x=element_text(angle=90,hjust=0.5,vjust=0.5)) + xlab ("University")

  1. Freestyle: Compare Mechanical Engineering and Civil Engineering departments and have an idea about student’s demand to these departments. (while max score for civil engineering departments is higher than mechanical engineering departmens in average, fill rate to the civil engineering departments is still higher than to the mechanical engineering programs)
civil <-osym_data_2017 %>% select (university_name, program_name, max_score, general_placement, general_quota ) %>% filter(program_name == "İnşaat Mühendisliği" ) %>% summarise(mean_civil = mean(max_score) , fillrate = sum(general_placement)/sum(general_quota))
civil
## # A tibble: 1 x 2
##   mean_civil fillrate
##        <dbl>    <dbl>
## 1        375     1.01
mechanical <-osym_data_2017 %>% select (university_name, program_name, max_score, general_placement, general_quota ) %>% filter(program_name == "Makine Mühendisliği" ) %>% summarise(mean_civil = mean(max_score) , fillrate = sum(general_placement)/sum(general_quota))
mechanical
## # A tibble: 1 x 2
##   mean_civil fillrate
##        <dbl>    <dbl>
## 1        341    0.967

Result : While max score for civil engineering departments is higher than mechanical engineering departmens in average, fill rate to the civil engineering departments is still higher than to the mechanical engineering programs.

  1. Freestyle: Compare Koç University with Bilkent University in terms of their IE Departments
bilkentvskoc <- osym_data_2017 %>% select(university_name , program_name, faculty_name , max_score) %>% filter( faculty_name == "Mühendislik Fakültesi",program_name =="Endüstri Mühendisliği (İngilizce) (Tam Burslu)" | program_name == "Endüstri Mühendisliği (İngilizce) (%50 Burslu)" | program_name == "Endüstri Mühendisliği (İngilizce) (%25 Burslu)",university_name =="İHSAN DOĞRAMACI BİLKENT ÜNİVERSİTESİ"| university_name == "KOÇ ÜNİVERSİTESİ")

bilkentvskoc
## # A tibble: 5 x 4
##   university_name                      program_name faculty_name max_score
##   <chr>                                <chr>        <chr>            <dbl>
## 1 İHSAN DOĞRAMACI BİLKENT ÜNİVERSİTESİ Endüstri Mü~ Mühendislik~       486
## 2 İHSAN DOĞRAMACI BİLKENT ÜNİVERSİTESİ Endüstri Mü~ Mühendislik~       515
## 3 KOÇ ÜNİVERSİTESİ                     Endüstri Mü~ Mühendislik~       497
## 4 KOÇ ÜNİVERSİTESİ                     Endüstri Mü~ Mühendislik~       507
## 5 KOÇ ÜNİVERSİTESİ                     Endüstri Mü~ Mühendislik~       540
ggplot(data=bilkentvskoc) + geom_bar(aes(x=program_name,  y= max_score, color= university_name), stat ="identity")