2  TUIK Preprocessing

2.1 Importing excel files

We stored Tuik data in separate sheets in Excel, so firstly we read all sheets and store them separately in tables in R.

library(readxl)
library(openxlsx)
  
path <- "docs/SummerMoon - TUIK - Issizlik Dataset.xlsx"

# getting data from sheets
sheets <- openxlsx::getSheetNames(path)
data_frame <- lapply(sheets, openxlsx::read.xlsx, xlsxFile=path)

# assigning names to data frame
names(data_frame) <- sheets

# printing the data
#print (data_frame)

list2env(data_frame, envir = .GlobalEnv)

lapply(names(data_frame), function(x)
  assign(x, data_frame[[x]], envir = .GlobalEnv)
)

2.2 Dataframes

Here are our tables which we analyze later.

names(data_frame)
 [1] "index"                           "Labour_force_by_household_pop"  
 [3] "Labour_force_status_by_reg"      "Employed_rate_by_marital_status"
 [5] "Unemployment_rate"               "Youth_unemployment_rate"        
 [7] "Reasons_of_not_being_in_lab_for" "Perc_of_pop_by_mar_status"      
 [9] "Mean_age_of_mother_by_Statistic" "Births_by_mothers_age_edu_grp"  
[11] "Crude_divorce_rate_by_provinces" "Births_of_mothers_by_reg_mar_st"
[13] "Mean_age_first_marriage_by_prvn" "Divorces_by_provinces"          
[15] "Birth_by_prov_mother_dur_of_mar" "Pop_by_province_place_birth_sta"
[17] "Employment_by_occup_group"      

2.3 Converting to RDS

Lastly, we convert all tables into RDS format and stored them in the ~/docs/tuik folder.

Please click to see RDS files

for (i in c(seq(1, length(names(data_frame)) ,1))) {
  saveRDS(data_frame[[i]],file = paste0("docs/tuik/",names(data_frame)[i],'.rds'))
}