tle: “OSYM_ANALYTICS”
thor: “Explorers”
te: “24 Ekim 2017”
tput: html_document

About The Task

Suppose, MEF University management asks you to examine the data and provide insights that are useful to understand MEF University’s place among its competitors and in the undergraduate market. Our technical team cleaned up the data for you as best as they can (you can check the raw data from here). Data is provided with the following commands and necessary information can be found below. You should explicitly state your code and process with clear communication. Assume management knows a bit of R and would like to reproduce your work in case there is any problem with the calculations. The university is not interested in universities abroad (IDs that start with 3 or 4).

Loading DataSet

load("osym_data_2017.RData")

Library Loading and Summary

library(tidyverse)
library(highcharter)
library(data.table)
library(stringr)

osym_data_2017<-data.table(osym_data_2017)

summary(osym_data_2017)
##    program_id        university_name        city          
##  Min.   :100110018   Length:11031       Length:11031      
##  1st Qu.:105510394   Class :character   Class :character  
##  Median :200210431   Mode  :character   Mode  :character  
##  Mean   :167009509                                        
##  3rd Qu.:204011062                                        
##  Max.   :409710072                                        
##  faculty_name       program_name        exam_type        
##  Length:11031       Length:11031       Length:11031      
##  Class :character   Class :character   Class :character  
##  Mode  :character   Mode  :character   Mode  :character  
##                                                          
##                                                          
##                                                          
##  general_quota     general_placement   min_score       max_score    
##  Min.   :   1.00   Min.   :   0.00   Min.   :180.0   Min.   :180.0  
##  1st Qu.:   9.00   1st Qu.:   6.00   1st Qu.:235.9   1st Qu.:280.2  
##  Median :  32.00   Median :  23.00   Median :281.1   Median :341.1  
##  Mean   :  46.07   Mean   :  37.65   Mean   :295.1   Mean   :338.3  
##  3rd Qu.:  60.00   3rd Qu.:  61.00   3rd Qu.:351.9   3rd Qu.:398.2  
##  Max.   :9000.00   Max.   :2050.00   Max.   :543.7   Max.   :569.1  
##    val_quota       val_placement     val_min_score   val_max_score  
##  Min.   :  0.000   Min.   : 0.0000   Min.   :180.0   Min.   :180.0  
##  1st Qu.:  0.000   1st Qu.: 0.0000   1st Qu.:180.0   1st Qu.:180.0  
##  Median :  0.000   Median : 0.0000   Median :180.0   Median :180.0  
##  Mean   :  1.131   Mean   : 0.4299   Mean   :207.6   Mean   :209.7  
##  3rd Qu.:  2.000   3rd Qu.: 0.0000   3rd Qu.:180.0   3rd Qu.:180.0  
##  Max.   :225.000   Max.   :16.0000   Max.   :524.6   Max.   :526.8
osymlocal<-osym_data_2017[substr(as.character(program_id),1,1)<=2,]

setkey(osymlocal,program_id)

sutunadlari<-colnames(osymlocal)

osymlocal[,program_statu:=ifelse((str_detect(program_name,"(%25 Burslu)") | str_detect(program_name,"(%50 Burslu)"))==TRUE,"Ucretli"
                                 ,ifelse(str_detect(program_name,"(İÖ)"),"IO","Burslu veya Devlet")),by=sutunadlari]


osymlocal[,MEF:=ifelse(substring(university_name,1,3)=="MEF",1,0),by=sutunadlari]

MEF<-osymlocal[MEF==1, ][order(-max_score)]

HP<-MEF[,max(max_score),.(exam_type,program_statu)]

setnames(HP,"V1","max_score")

setkey(MEF,max_score,exam_type,program_statu)
setkey(HP,max_score,exam_type,program_statu)

MEFHP<-MEF[HP,nomatch=0]

MEFHP
##    program_id  university_name     city
## 1:  207210067 MEF ÜNYVERSYTESY YSTANBUL
## 2:  207210376 MEF ÜNYVERSYTESY YSTANBUL
## 3:  207210049 MEF ÜNYVERSYTESY YSTANBUL
## 4:  207210252 MEF ÜNYVERSYTESY YSTANBUL
## 5:  207210358 MEF ÜNYVERSYTESY YSTANBUL
## 6:  207210419 MEF ÜNYVERSYTESY YSTANBUL
## 7:  207210076 MEF ÜNYVERSYTESY YSTANBUL
## 8:  207210394 MEF ÜNYVERSYTESY YSTANBUL
## 9:  207210331 MEF ÜNYVERSYTESY YSTANBUL
##                                    faculty_name
## 1: Yktisadi, Ydari ve Sosyal Bilimler Fakültesi
## 2:                             E<U+00F0>itim Fakültesi
## 3: Yktisadi, Ydari ve Sosyal Bilimler Fakültesi
## 4:         Sanat, Tasarym ve Mimarlyk Fakültesi
## 5:                              Hukuk Fakültesi
## 6:                             E<U+00F0>itim Fakültesi
## 7:                        Mühendislik Fakültesi
## 8:                             E<U+00F0>itim Fakültesi
## 9:                 Hukuk Fakültesi (Tam Burslu)
##                                                  program_name exam_type
## 1:                           Y<U+00FE>letme (Yngilizce) (%50 Burslu)      TM_1
## 2: Ylkö<U+00F0>retim Matematik Ö<U+00F0>retmenli<U+00F0>i (Yngilizce) (Tam Burslu)      MF_1
## 3:                           Y<U+00FE>letme (Yngilizce) (Tam Burslu)      TM_1
## 4:                          Mimarlyk (Yngilizce) (%50 Burslu)      MF_4
## 5:                                         Hukuk (%50 Burslu)      TM_3
## 6:            Yngilizce Ö<U+00F0>retmenli<U+00F0>i (Yngilizce) (%50 Burslu)     DYL_1
## 7:           Bilgisayar Mühendisli<U+00F0>i (Yngilizce) (Tam Burslu)      MF_4
## 8:            Yngilizce Ö<U+00F0>retmenli<U+00F0>i (Yngilizce) (Tam Burslu)     DYL_1
## 9:                                         Hukuk (Tam Burslu)      TM_3
##    general_quota general_placement min_score max_score val_quota
## 1:            22                20  218.3906  283.9486         0
## 2:             2                 2  386.4204  386.6900         0
## 3:             4                 4  393.8451  398.7630         0
## 4:            33                33  350.5076  412.3419         0
## 5:            25                25  403.8408  416.0686         0
## 6:            32                32  292.9123  424.9534         0
## 7:             3                 3  429.7522  445.0601         0
## 8:             4                 4  447.1165  456.0084         0
## 9:            17                17  432.7763  459.0143         0
##    val_placement val_min_score val_max_score      program_statu MEF
## 1:             0           180           180            Ucretli   1
## 2:             0           180           180 Burslu veya Devlet   1
## 3:             0           180           180 Burslu veya Devlet   1
## 4:             0           180           180            Ucretli   1
## 5:             0           180           180            Ucretli   1
## 6:             0           180           180            Ucretli   1
## 7:             0           180           180 Burslu veya Devlet   1
## 8:             0           180           180 Burslu veya Devlet   1
## 9:             0           180           180 Burslu veya Devlet   1

Data Preparation & Cleaning

osymlocal[, c("program_name1", "program_name2","program_name3","program_name4","program_name5") := tstrsplit(str_trim(program_name), "(", fixed=TRUE)]
osymlocal$program_name1<-str_trim(osymlocal$program_name1)
osymlocal$program_name2<-str_trim(osymlocal$program_name2)
osymlocal$program_name3<-str_trim(osymlocal$program_name3)
osymlocal$program_name4<-str_trim(osymlocal$program_name4)
osymlocal$program_name5<-str_trim(osymlocal$program_name5)

osymlocal<-osymlocal[program_name2!="KKTC Uyruklu)" | is.na(program_name2)==TRUE]
osymlocal<-osymlocal[program_name3!="KKTC Uyruklu)" | is.na(program_name3)==TRUE]
osymlocal<-osymlocal[program_name3!="KKTC Vatandaşları)" | is.na(program_name3)==TRUE]
osymlocal<-osymlocal[program_name2!="UOLP - Köln Üniversitesi)" | is.na(program_name2)==TRUE]
osymlocal<-osymlocal[program_name2!="Açıköğretim)" | is.na(program_name2)==TRUE]
osymlocal<-osymlocal[program_name3!="Açıköğretim)" | is.na(program_name3)==TRUE]
osymlocal<-osymlocal[program_name2!="Uzaktan Öğretim)" | is.na(program_name2)==TRUE]

osymlocal<-osymlocal[program_name2!="Tam Burslu)" | is.na(program_name2)==TRUE]
osymlocal<-osymlocal[program_name3!="Tam Burslu)" | is.na(program_name3)==TRUE]

Programs at MEF University

MEFPrograms<-osymlocal[MEF==1,list(mean(min_score),sum(general_quota),sum(general_placement)
                      ,sum(general_placement)/sum(general_quota)),.(university_name,city,program_name1)][order(-V1)]
setnames(MEFPrograms,"V1","min_score")
setnames(MEFPrograms,"V2","general_quota")
setnames(MEFPrograms,"V3","general_placement")
setnames(MEFPrograms,"V4","fullness")
setnames(MEFPrograms,"program_name1","program_name")

hchart(MEFPrograms[order(-min_score)],type="column",hcaes(x=program_name,y=min_score,group=university_name)) %>%
  hc_add_theme(hc_theme_google())
hchart(MEFPrograms[order(-min_score)],type="column",hcaes(x=program_name,y=fullness,group=university_name)) %>%
  hc_add_theme(hc_theme_google())

The Scores of Business Adminstration

programs<-osymlocal[,list(mean(min_score),sum(general_quota),sum(general_placement),sum(general_placement)/sum(general_quota)),.(university_name,city,program_name1)]
setnames(programs,"V1","min_score")
setnames(programs,"V2","general_quota")
setnames(programs,"V3","general_placement")
setnames(programs,"V4","fullness")
setnames(programs,"program_name1","program_name")

hchart(programs[program_name=="İşletme",][order(-min_score)],type="column",hcaes(x=university_name,y=min_score,group=program_name)) %>%
  hc_add_theme(hc_theme_google())
ggplot(programs[program_name=="İşletme",],aes(x=reorder(university_name,-min_score),y=min_score,fill=university_name=="MEF ÜNİVERSİTESİ")) +
  geom_bar(stat="identity",position="dodge",) +
  facet_wrap(~program_name) +
  theme(axis.text.x = element_text(angle=90)) +
  ggtitle("İşletme Min_Scores")

ggplot(programs[program_name=="İşletme" & city=="İSTANBUL",],aes(x=reorder(university_name,-min_score),y=min_score,fill=university_name=="MEF ÜNİVERSİTESİ")) +
  geom_bar(stat="identity",position="dodge",) +
  facet_wrap(~program_name) +
  theme(axis.text.x = element_text(angle=90)) +
  ggtitle("İşletme Min_Scores")

The Scores of Law Program

ggplot(programs[program_name=="Hukuk",],aes(x=reorder(university_name,-min_score),y=min_score,fill=university_name=="MEF ÜNİVERSİTESİ")) +
  geom_bar(stat="identity",position="dodge",) +
  facet_wrap(~program_name) +
  theme(axis.text.x = element_text(angle=90)) +
  ggtitle("Hukuk Min_Scores")

ggplot(programs[program_name=="Hukuk" & city=="İSTANBUL",],aes(x=reorder(university_name,-min_score),y=min_score,fill=university_name=="MEF ÜNİVERSİTESİ")) +
  geom_bar(stat="identity",position="dodge",) +
  facet_wrap(~program_name) +
  theme(axis.text.x = element_text(angle=90)) +
  ggtitle("Hukuk Min_Scores")