#-------------------------------------------------------------------------------------------------------------------. # REGISTER CENSUS 2011 # Dataset HOUSEHOLD # # This R! routine adds variable and value labels. # It works with Register Census 2011 microdata, prepared by SORS in April 2014. # Your dataset might have a smaller set of variables. # # Version 1, December 2014 # R 3.1.2 # # Social Science Data Archives, University of Ljubljana # Sebastian Kocar # http://www.adp.fdv.uni-lj.si/ # Contact: arhiv.podatkov@fdv.uni-lj.si # # This R code is protected under the Creative Commons licence. #-------------------------------------------------------------------------------------------------------------------. #--- CONFIGURATION SECTION --- START --- # The following commands should contain the complete path and # name of the .txt file to be read (e.g. 'C:/Census2011_v1.txt') # and the .txt file to be saved with labels (e.g. 'C:/Census2011_labels.txt') # Change TXT_DATA_PATH to your filename. # Change TXT_DATA_PATH_SAVE to your filename. #--- CONFIGURATION SECTION --- END --- #-------------------------------------------------------------------------------------------------------------------. #----------------------------------------------Start data processing------------------------------------------------. #--- importing data data<-read.delim("TXT_DATA_PATH", header = TRUE, sep = "\t", dec=",") #--- adding labels for variables and variable values require(Hmisc) label(data$ID_GO) <- "Household ID" label(data$TIP_GO) <- "Type of household; 1 - One-person, 2 - Multi-person non-family of relatives and non-relatives, 3 - Multi-person non-family of grandparents, grandchildren or si, 4 - Multi-person one-family, 5 - Multi-person one-family extended, 6 - Multi-person two or more-family, 7 - Multi-person two or more-family extended, 8 - Institutional household, 9 - Other household" label(data$GO_OS) <- "Household size" label(data$GO_M) <- "Number of men in the household" label(data$GO_Z) <- "Number of women in the household" label(data$GO_SK_0_5) <- "Number of members aged 0-5 years - total" label(data$GO_SK_6_14) <- "Number of members aged 6-14 years - total" label(data$GO_SK_15_19) <- "Number of members aged 15-19 years - total" label(data$GO_SK_20_29) <- "Number of members aged 20-29 years - total" label(data$GO_SK_30_49) <- "Number of members aged 30-49 years - total" label(data$GO_SK_50_64) <- "Number of members aged 50-64 years - total" label(data$GO_SK_65_84) <- "Number of members aged 65-84 years - total" label(data$GO_SK_85_PLUS) <- "Number of members aged 85 years or more - total" label(data$GO_M_0_5) <- "Number of members aged 0-5 years - men" label(data$GO_M_6_14) <- "Number of members aged 6-14 years - men" label(data$GO_M_15_19) <- "Number of members aged 15-19 years - men" label(data$GO_M_20_29) <- "Number of members aged 20-29 years - men" label(data$GO_M_30_49) <- "Number of members aged 30-49 years - men" label(data$GO_M_50_64) <- "Number of members aged 50-64 years - men" label(data$GO_M_65_84) <- "Number of members aged 65-84 years - men" label(data$GO_M_85_PLUS) <- "Number of members aged 85 years or more - men" label(data$GO_Z_0_5) <- "Number of members aged 0-5 years - women" label(data$GO_Z_6_14) <- "Number of members aged 6-14 years - women" label(data$GO_Z_15_19) <- "Number of members aged 15-19 years - women" label(data$GO_Z_20_29) <- "Number of members aged 20-29 years - women" label(data$GO_Z_30_49) <- "Number of members aged 30-49 years - women" label(data$GO_Z_50_64) <- "Number of members aged 50-64 years - women" label(data$GO_Z_65_84) <- "Number of members aged 65-84 years - women" label(data$GO_Z_85_PLUS) <- "Number of members aged 85 years or more - women" label(data$GO_SK_0_14) <- "Number of members aged 0-14 years - total" label(data$GO_SK_0_29) <- "Number of members aged 0-29 years - total" label(data$GO_SK_65_PLUS) <- "Number of members aged 65 years or more - total" label(data$GO_M_0_14) <- "Number of members aged 0-14 years - men" label(data$GO_M_0_29) <- "Number of members aged 0-29 years - men" label(data$GO_M_65_PLUS) <- "Number of members aged 65 years or more - men" label(data$GO_Z_0_14) <- "Number of members aged 0-14 years - women" label(data$GO_Z_0_29) <- "Number of members aged 0-29 years - women" label(data$GO_Z_65_PLUS) <- "Number of members aged 65 years or more - women" label(data$GO_SK_0_34) <- "Number of members aged 0-34 years - total" label(data$GO_SK_35_49) <- "Number of members aged 35-49 years - total" label(data$GO_SK_50_69) <- "Number of members aged 50-69 years - total" label(data$GO_SK_70_PLUS) <- "Number of members aged 70 years or more - women" label(data$TIP_STAR_GO) <- "Age structure of household; 1 - Young generation household, all members under 35 years, 2 - Young and middle generation household, all members under 50, 3 - Middle generation household, all members aged 35-49 years, 4 - Middle and older generation household, all members aged 35-6, 5 - Older generation household, all members aged 50-69 years, 6 - Older and elderly generation household, all members over 50, 7 - Elderly generation household, all members over 70 years, 8 - Skip age-group generation household, 9 - Household with three or four age-group generations" label(data$GO_OTR) <- "Number of children in the household" label(data$GO_OTR_0_5) <- "Number of children in the household aged 0-5 years" label(data$GO_OTR_0_17) <- "Number of children in the household aged 0-17 years" label(data$GO_OTR_0_24) <- "Number of children in the household aged 0-24 years" label(data$TIP_GEN_GO) <- "Generational composition of household; 1 - First generation only, 2 - Two successive generations, 3 - Three successive generations, 4 - Four successive generations, 5 - First, second and fourth generation, 6 - First and third generation, 7 - First, third and fourth generation, 8 - One-person household, 9 - Data on generation not available" label(data$TIP_DRZ_GO) <- "Household composition by citizenship; 1 - Citizens of the RS with permanent residence only, 2 - Citizens of the RS with temporary residence only, 3 - Citizens of the RS with permanent and temporary residence, 4 - Foreign citizens with permanent residence only, 5 - Foreign citizens with temporary residence only, 6 - Foreign citizens with permanent and temporary residence, 7 - Citizens of the RS and foreign citizens" label(data$GO_P1) <- "Number of resident type 1 in the household" label(data$GO_P2) <- "Number of resident type 2 in the household" label(data$GO_P3) <- "Number of resident type 3 in the household" label(data$GO_P4) <- "Number of resident type 4 in the household" label(data$TIP_PRIS_GO_2) <- "Immigrant background of household; 1 - First generation immigrants only, 2 - First and second generation of immigrants, 3 - Second generation immigrants only, 4 - Second and third generation of immigrants, 5 - Third generation immigrants only, 6 - First generation immigrants and persons without immigrant ba, 7 - First and second generation of immigrants and persons withou, 8 - Second generation immigrants and persons without immigrant b, 9 - Second and third generation of immigrants and persons withou, 10 - Third generation immigrants and persons without immigrant ba, 11 - First, second and third generation of immigrants, 12 - First, second and third generation of immigrants and persons, 13 - First and third generation of immigrants, 14 - First and third generation of immigrants and persons without, 15 - No persons with immigrant background, 16 - Persons without immigrant background and persons without dat, 17 - Persons without data on immigrant background" label(data$GO_PRIS_1) <- "Number of first generation immigrants in the household" label(data$GO_PRIS_2) <- "Number of second generation immigrants in the household" label(data$GO_PRIS_3) <- "Number of third generation immigrants in the household" label(data$GO_NI_PRIS) <- "Number of members without immigrant background in the household" label(data$GO_NN_PRIS) <- "Number of members with unknown immigrant background in the household" label(data$GO_AKT) <- "Number of economically active members in the household" label(data$GO_DAKT) <- "Number of employed members in the household" label(data$GO_BP) <- "Number of unemployed members in the household" label(data$GO_NEAKT) <- "Number of not economically active members in the household" label(data$GO_SOL) <- "Number of students in the household" label(data$GO_UPOK) <- "Number of pension recipients in the household" label(data$GO_DR_NEAKT) <- "Number of other not economically active members in the household" label(data$GO_IZB_OS) <- "Number of members with basic education or less in the household" label(data$GO_IZB_SS) <- "Number of members with secondary education or less in the household" label(data$GO_IZB_TER) <- "Number of members with tertiary education or less in the household" label(data$GO_ST_DRUZ) <- "Number of families in the household" label(data$GO_DRUZ_TIP_1) <- "Number of family type 1 in the household" label(data$GO_DRUZ_TIP_2) <- "Number of family type 2 in the household" label(data$GO_DRUZ_TIP_3) <- "Number of family type 3 in the household" label(data$GO_DRUZ_TIP_4) <- "Number of family type 4 in the household" label(data$GO_DRUZ_TIP_5) <- "Number of family type 5 in the household" label(data$GO_DRUZ_TIP_6) <- "Number of family type 6 in the household" label(data$GO_DRUZ_TIP_7) <- "Number of family type 7 in the household" label(data$GO_DRUZ_TIP_8) <- "Number of family type 8 in the household" label(data$GO_DRUZ_TIP_9) <- "Number of family type 9 in the household" label(data$SP_REF_GO) <- "Sex of the reference person of the household; 1 - Male, 2 - Female" label(data$STAR_REF_GO) <- "Age of the reference person of the household" label(data$ZS_REF_GO) <- "Marital status of the reference person of the household; 1 - Single, 2 - Married, 3 - Widow/er, 4 - Divorced, 5 - Same gender partnership, 6 - Terminated IPS -death, 7 - Terminated IPS - other, 9 - Unknown" label(data$HS_MID_NAST) <- "Type of accommodation; 1 - Social work center without conventional dwellings, 2 - Residence for pupils and students, 3 - Postgraduate´s house, 4 - Special social care institute, 5 - Community, 6 - Prison, 7 - Religious institution, 8 - Elderly home, 9 - Elderly home with private households, 10 - Residence for students and religious institution, 11 - Elderly home, religious institution and private households, 12 - Elderly home and private households, 13 - Residence for students, religious institution and private ho, 14 - Worker dormitory in non-residential building, 15 - Worker dormitory with short-term settlement, 16 - Worker dormitory for communities, 17 - Worker dormitory in one-dwelling building, 18 - Worker dormitory in multi-dwelling building, 19 - Residence for students, worker dormitory and conventional dw, 20 - Religious institution, residence for students and private ho, 21 - Special social care institute with private households, 22 - Roma settlement, 23 - Social work center with conventional dwellings, 24 - Special accommodation center, 25 - Residence for students in building with conventional dwellin, 26 - Residence for pupils and students without institutional hous, 27 - Religious institution without institutional household, 28 - Special social care institute without institutional househol, 29 - Hotel and other tourist accommodation, 30 - Collective living quarter as a part of the building, 31 - Collective living quarter with 7 or less residents" label(data$ID_KOHEZIJSKA) <- "Usual residence - cohesion region - LOOK UP CODEBOOK RPE_POPIS_2011" label(data$ID_STATISTICNA) <- "Usual residence - statistical region - LOOK UP CODEBOOK RPE_POPIS_2011" label(data$ID_OBCINA) <- "Usual residence - municipality - LOOK UP CODEBOOK RPE_POPIS_2011" label(data$NA_ID) <- "Usual residence - settlement - LOOK UP CODEBOOK RPE_POPIS_2011" label(data$TIP_NASELJA) <- "Type of settlement / area; DN - Non-urban settlement, M - Urban settlement, NMO - Settlement within urban area" label(data$VEL_NAS) <- "Size of locality; 1 - 1,000,000 inhabitants or more, 2 - From 500,000 to 999,999 inhabitants, 3 - From 200,000 to 499,999 inhabitants, 4 - From 100,000 to 199,999 inhabitants, 5 - From 50,000 to 99,999 inhabitants, 6 - From 20,000 to 49,999 inhabitants, 7 - From 10,000 to 19,999 inhabitants, 8 - From 5,000 to 9,999 inhabitants, 9 - From 2,000 to 4,999 inhabitants, 10 - From 1,000 to 1,999 inhabitants, 11 - From 500 to 999 inhabitants, 12 - From 200 to 499 inhabitants, 13 - From 100 to 199 inhabitants, 14 - From 50 to 99 inhabitants, 15 - From 25 to 49 inhabitants, 16 - From 1 to 24 inhabitants, 17 - No inhabitants" label(data$ST_STAN_GO) <- "Number of dwellings used by household" label(data$ST_GO_STAN) <- "Number of households in the housing unit" label(data$TIP_STAN_ENOTE) <- "Type of living quarters; 1 - Conventional dwelling, 2 - Collective living quarter, 3 - Other housing unit, 4 - Different intitutions dealling also with homless people like, 5 - Unknown, 6 - Other parts of buildings" label(data$TIP_LASTNISTVA) <- "Dwelling ownership; 1 - Owner-occupied dwellings, 2 - Dwellings in cooperative ownership, 3 - Rented dwellings, 4 - Dwellings in other types of ownership, 5 - Not stated, 6 - Not applicable" label(data$GO_UPOR) <- "Tenure status of person; 1 - At least one household member is the owner of the housing un, 2 - At least one household member is the tenant of the housing u, 3 - Household occupying a housing unit under some other form of" label(data$UPOR_POVR_STAN) <- "Useful floor space" label(data$UPOR_POVR_GO) <- "Useful floor space per household" label(data$UPOR_POVR_GO_R) <- "Useful floor space - range; 1 - Under 30 square metres, 2 - 30 — less than 40 square metres, 3 - 40 — less than 50 square metres, 4 - 50 — less than 60 square metres, 5 - 60 — less than 80 square metres, 6 - 80 — less than 100 square metres, 7 - 100 — less than 120 square metres, 8 - 120 — less than 150 square metres, 9 - 150 square metres and over, 10 - Not stated" label(data$UPOR_POVR_GO_OS) <- "Density standard" label(data$UPOR_POVR_GO_OS_R) <- "Density standard - range; 1 - less than 10 m2, 2 - 10 - less than 15 m2, 3 - 15 - less than 20 m2, 4 - 20 - less than 30 m2, 5 - 30 - less than 40 m2, 6 - 40 - less than 60 m2, 7 - 60 - less than 80 m2, 8 - 80 m2 and more, 9 - Not stated" label(data$ST_SOB_STAN) <- "Number of rooms" label(data$ST_SOB_GO) <- "Number of rooms per household" label(data$ID_KUHINJA) <- "Kitchen in the dwelling; 1 - Yes, 2 - No" label(data$ID_STRANISCE) <- "Toilet in the dwelling; 1 - Yes, 2 - No" label(data$ID_KOPALNICA) <- "Bathroom in the dwelling; 1 - Yes, 2 - No" label(data$VODA_VSTAN) <- "Piped water in the dwelling; 1 - Piped water in the housing unit, 2 - No piped water in the housing unit, 3 - Not stated" label(data$ID_ELEKTRIKA) <- "Electricity in the dwelling; 1 - Yes, 2 - No" label(data$ID_TELEFON) <- "Telephone in the dwelling; 1 - Yes, 2 - No" label(data$ID_PLIN) <- "Piped gas in the dwelling; 1 - Yes, 2 - No" label(data$ID_VODOVOD) <- "Water supply system in the dwelling; 1 - Yes, 2 - No" label(data$ID_KANALIZACIJA) <- "Sewage disposal system in the dwelling; 1 - Yes, 2 - No" label(data$ID_OGREVANJE) <- "Type of heating; 1 - Heating by community heating centre, 2 - Central heating, 3 - Other type of heating, 4 - No heating" label(data$KOP_WC_GO) <- "Basic dwelling facilities; 1 - Dwelling with water supply system, toilet and bathing facili, 2 - Dwelling with water supply system and toilet facilities with, 3 - Dwelling with water supply system and bathing facilities wit, 4 - Dwelling with water supply system without bathing and toilet, 5 - Dwelling without water supply system with bathing and toilet, 6 - Dwelling without water supply system and bathing facilities, 7 - Dwelling without water supply system and toilet facilities w, 8 - Dwelling without water supply system, toilet and bathing fac, 9 - Other housing unit" label(data$LETO_IZG_STA) <- "Year of construction" label(data$LETO_IZG_STA_R) <- "Year of construction - range; 1 - Earlier than 1919, 2 - 1919 – 1945, 3 - 1946 – 1960, 4 - 1961 – 1970, 5 - 1971 – 1980, 6 - 1981 – 1990, 7 - 1991 – 2000, 8 - 2001 – 2005, 9 - 2006 and after, 10 - Not specified" label(data$DST_SID_K) <- "Building part ID - final" #----------------------------------------------End data processing------------------------------------------------. #--- displaying all labels attach(data) describe(data) #--- saving txt dataset with labels write.table(data, "TXT_DATA_PATH_SAVE", quote = FALSE, sep = "\t", dec=",", na = "NA")