Create a metadata table from the survey data files.

metadata_create(survey)

Arguments

survey

A survey data frame.

Value

A nested data frame with metadata and the range of labels, na_values and the na_range itself.

Details

The structure of the returned tibble:

filename

The original file name; if present; missing, if a non-survey data frame is used as input survey.

id

The ID of the survey, if present; missing, if a non-survey data frame is used as input survey.

var_name_orig

The original variable name in SPSS.

class_orig

The original variable class after importing withread_spss.

label_orig

The original variable label in SPSS.

labels

A list of the value labels.

valid_labels

A list of the value labels that are not marked as missing values.

na_labels

A list of the value labels that refer to user-defined missing values.

na_range

An optional range of a continuous missing range, if present in the vector.

n_labels

Number of categories or unique levels, which may be different from the sum of missing and category labels.

n_valid_labels

Number of categories in the non-missing range.

n_na_labels

Number of categories of the variable, should be the sum of the former two.

na_levels

A list of the user-defined missing values.

Examples

metadata_create ( survey = read_rds ( system.file("examples", "ZA7576.rds", package = "retroharmonize") ) )
#> filename id var_name_orig class_orig #> 1 ZA7576.rds ZA7576 rowid character #> 2 ZA7576.rds ZA7576 doi character #> 3 ZA7576.rds ZA7576 version character #> 4 ZA7576.rds ZA7576 uniqid numeric #> 5 ZA7576.rds ZA7576 caseid numeric #> 6 ZA7576.rds ZA7576 serialid numeric #> 7 ZA7576.rds ZA7576 isocntry character #> 8 ZA7576.rds ZA7576 p1 haven_labelled #> 9 ZA7576.rds ZA7576 p2 haven_labelled #> 10 ZA7576.rds ZA7576 p3 haven_labelled_spss #> 11 ZA7576.rds ZA7576 p4 haven_labelled #> 12 ZA7576.rds ZA7576 p5 haven_labelled #> 13 ZA7576.rds ZA7576 nuts haven_labelled #> 14 ZA7576.rds ZA7576 d7 haven_labelled #> 15 ZA7576.rds ZA7576 d8 haven_labelled #> 16 ZA7576.rds ZA7576 d25 haven_labelled_spss #> 17 ZA7576.rds ZA7576 d60 haven_labelled #> 18 ZA7576.rds ZA7576 qa14_5 haven_labelled #> 19 ZA7576.rds ZA7576 qa14_3 haven_labelled_spss #> 20 ZA7576.rds ZA7576 qa14_2 haven_labelled_spss #> 21 ZA7576.rds ZA7576 qa14_4 haven_labelled_spss #> 22 ZA7576.rds ZA7576 qa14_1 haven_labelled_spss #> 23 ZA7576.rds ZA7576 qa6a_5 haven_labelled_spss #> 24 ZA7576.rds ZA7576 qa6a_10 haven_labelled_spss #> 25 ZA7576.rds ZA7576 qa6b_2 haven_labelled_spss #> 26 ZA7576.rds ZA7576 qa6a_3 haven_labelled_spss #> 27 ZA7576.rds ZA7576 qa6a_1 haven_labelled_spss #> 28 ZA7576.rds ZA7576 qa6b_4 haven_labelled_spss #> 29 ZA7576.rds ZA7576 qa6a_8 haven_labelled_spss #> 30 ZA7576.rds ZA7576 qa6a_9 haven_labelled_spss #> 31 ZA7576.rds ZA7576 qa6a_4 haven_labelled_spss #> 32 ZA7576.rds ZA7576 qa6a_2 haven_labelled_spss #> 33 ZA7576.rds ZA7576 qa6b_1 haven_labelled_spss #> 34 ZA7576.rds ZA7576 qa6a_6 haven_labelled_spss #> 35 ZA7576.rds ZA7576 qa6a_7 haven_labelled_spss #> 36 ZA7576.rds ZA7576 qa6a_11 haven_labelled_spss #> 37 ZA7576.rds ZA7576 qa6b_3 haven_labelled_spss #> 38 ZA7576.rds ZA7576 qd6.1 haven_labelled_spss #> 39 ZA7576.rds ZA7576 qd6.2 haven_labelled_spss #> 40 ZA7576.rds ZA7576 qd6.3 haven_labelled_spss #> 41 ZA7576.rds ZA7576 qd6.4 haven_labelled_spss #> 42 ZA7576.rds ZA7576 qd6.5 haven_labelled_spss #> 43 ZA7576.rds ZA7576 qd6.6 haven_labelled_spss #> 44 ZA7576.rds ZA7576 qd6.7 haven_labelled_spss #> 45 ZA7576.rds ZA7576 qd6.8 haven_labelled_spss #> 46 ZA7576.rds ZA7576 qd6.9 haven_labelled_spss #> 47 ZA7576.rds ZA7576 qd6.10 haven_labelled_spss #> 48 ZA7576.rds ZA7576 qd6.11 haven_labelled_spss #> 49 ZA7576.rds ZA7576 qd6.12 haven_labelled_spss #> 50 ZA7576.rds ZA7576 qd6.13 haven_labelled_spss #> 51 ZA7576.rds ZA7576 qd6.14 haven_labelled_spss #> 52 ZA7576.rds ZA7576 qg1b haven_labelled_spss #> 53 ZA7576.rds ZA7576 qg8 haven_labelled_spss #> 54 ZA7576.rds ZA7576 w1 numeric #> 55 ZA7576.rds ZA7576 w3 numeric #> 56 ZA7576.rds ZA7576 wex numeric #> label_orig #> 1 unique identifier in za7576 #> 2 digital object identifier #> 3 gesis archive version and date #> 4 unique respondent id caseid by kantar country code #> 5 kantar case id country specific #> 6 serial case id appointed by kantar #> 7 country code iso 3166 #> 8 date of interview #> 9 time of interview #> 10 duration of interview #> 11 n of persons present during interview #> 12 respondent cooperation #> 13 region nuts codes #> 14 marital status #> 15 age education #> 16 type of community #> 17 difficulties paying bills last year #> 18 council of the eu trust #> 19 european central bank trust #> 20 european commission trust #> 21 european council trust #> 22 european parliament trust #> 23 trust in institutions army #> 24 trust in institutions european union #> 25 trust in institutions european union tcc #> 26 trust in institutions justice legal system #> 27 trust in institutions media #> 28 trust in institutions media tcc #> 29 trust in institutions national government #> 30 trust in institutions national parliament #> 31 trust in institutions police #> 32 trust in institutions political parties #> 33 trust in institutions political parties tcc #> 34 trust in institutions public administration #> 35 trust in institutions reg local public authorities #> 36 trust in institutions united nations #> 37 trust in institutions united nations tcc #> 38 important values pers rule of law #> 39 important values pers respect human life #> 40 important values pers human rights #> 41 important values pers individual freedom #> 42 important values pers democracy #> 43 important values pers peace #> 44 important values pers equality #> 45 important values pers solidarity #> 46 important values pers tolerance #> 47 important values pers religion #> 48 important values pers self fulfilment #> 49 important values pers respect for cultures #> 50 important values pers none spont #> 51 important values pers dk #> 52 voters when decided to vote #> 53 non voters when decided not to vote #> 54 weight result from target redressment #> 55 weight germany #> 56 weight extrapolated population aged 15 plus #> labels #> 1 NA #> 2 NA #> 3 NA #> 4 NA #> 5 NA #> 6 NA #> 7 NA #> 8 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 #> 9 1, 2, 3, 4, 5, 6, 8 #> 10 1, 363, 377, 383, 388, 392, 409, 414, 416, 452, 454, 482, 531, 537, 543, 548, 555, 604, 613, 627, 656, 709, 738, 744, 747, 999 #> 11 1, 2, 3, 4, 5 #> 12 1, 2, 3, 4, 5 #> 13 ME, RS, MT, LU, CY, DE1, DE2, DE3, DE4, DE5, DE6, DE7, DE8, DE9, FR9, DEA, DEB, DEC, UKC, ITC, DED, UKD, DEE, UKE, DEF, UKF, ITF, DEG, UKG, ITG, UKH, ITH, UKI, ITI, UKJ, UKK, UKL, UKM, UKN, BE10, FR10, TR10, HU10, PT20, EL30, FR30, ES30, PT30, ES70, TR90, DK01, SK01, CZ01, SE11, EL11, NL11, PL11, RO11, ES11, AT11, PT11, BE21, SE21, EL21, NL21, PL21, RO21, FR21, TR21, ES21, AT21, HU21, BE31, SE31, BG31, NL31, PL31, RO31, TR31, AT31, HU31, BG41, EL41, NL41, PL41, RO41, FR41, TR41, ES41, PL51, FR51, TR51, ES51, PL61, FR61, TR61, ES61, FR71, TR71, FR81, TR81, TRA1, TRB1, TRC1, DK02, SK02, CZ02, SE12, EL12, NL12, PL12, RO12, ES12, AT12, BE22, SE22, EL22, NL22, PL22, RO22, FR22, TR22, ES22, AT22, HU22, BE32, SE32, BG32, NL32, PL32, RO32, TR32, AT32, HU32, BG42, EL42, NL42, PL42, RO42, FR42, TR42, ES42, PL52, FR52, TR52, ES52, PL62, FR62, TR62, ES62, FR72, TR72, FR82, TR82, TRA2, TRB2, TRC2, DK03, SK03, CZ03, EL13, NL13, ES13, AT13, BE23, SE23, EL23, NL23, FR23, ES23, HU23, BE33, SE33, BG33, NL33, PL33, TR33, AT33, HU33, EL43, PL43, FR43, ES43, FR53, ES53, PL63, FR63, TR63, ES63, FR83, TR83, TRC3, DK04, SK04, CZ04, EL14, BE24, EL24, FR24, ES24, BE34, BG34, NL34, PL34, AT34, ES64, DK05, CZ05, PT15, BE25, EL25, FR25, BE35, CZ06, PT16, FR26, CZ07, PT17, CZ08, PT18, FI19, FI1B, FI1C, FI1D, FI200, EE001, MK001, LT001, IE011, SI011, AL011, IE021, SI021, AL021, AL031, HR031, HR041, MK002, LT002, IE012, SI012, AL012, IE022, SI022, AL022, AL032, HR032, HR042, MK003, LT003, LV003, IE013, SI013, AL013, IE023, SI023, AL033, HR033, HR043, EE004, MK004, LT004, SI014, AL014, IE024, SI024, AL034, HR034, HR044, MK005, LT005, LV005, SI015, AL015, IE025, AL035, HR035, HR045, EE006, MK006, LT006, LV006, SI016, HR036, HR046, EE007, MK007, LT007, LV007, SI017, HR037, HR047, EE008, MK008, LT008, LV008, SI018, HR048, LT009, LV009, HR049, LT00A, HR04A, HR04B, HR04C, CYTCC, HR04D, HR04E #> 14 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 97 #> 15 0, 2, 89, 97, 98, 99 #> 16 1, 2, 3, 8 #> 17 1, 2, 3, 7 #> 18 1, 2, 3, 9 #> 19 1, 2, 3, 9 #> 20 1, 2, 3, 9 #> 21 1, 2, 3, 9 #> 22 1, 2, 3, 9 #> 23 1, 2, 3, 9 #> 24 1, 2, 3, 9 #> 25 1, 2, 3, 9 #> 26 1, 2, 3, 9 #> 27 1, 2, 3, 9 #> 28 1, 2, 3, 9 #> 29 1, 2, 3, 9 #> 30 1, 2, 3, 9 #> 31 1, 2, 3, 9 #> 32 1, 2, 3, 9 #> 33 1, 2, 3, 9 #> 34 1, 2, 3, 9 #> 35 1, 2, 3, 9 #> 36 1, 2, 3, 9 #> 37 1, 2, 3, 9 #> 38 0, 1, 9 #> 39 0, 1, 9 #> 40 0, 1, 9 #> 41 0, 1, 9 #> 42 0, 1, 9 #> 43 0, 1, 9 #> 44 0, 1, 9 #> 45 0, 1, 9 #> 46 0, 1, 9 #> 47 0, 1, 9 #> 48 0, 1, 9 #> 49 0, 1, 9 #> 50 0, 1, 9 #> 51 0, 1, 9 #> 52 1, 2, 3, 4, 5, 6, 9, 99 #> 53 1, 2, 3, 4, 5, 6, 9, 99 #> 54 NA #> 55 NA #> 56 NA #> valid_labels #> 1 NA #> 2 NA #> 3 NA #> 4 NA #> 5 NA #> 6 NA #> 7 NA #> 8 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21 #> 9 1, 2, 3, 4, 5, 6, 8 #> 10 1, 363, 377, 383, 388, 392, 409, 414, 416, 452, 454, 482, 531, 537, 543, 548, 555, 604, 613, 627, 656, 709, 738, 744, 747 #> 11 1, 2, 3, 4, 5 #> 12 1, 2, 3, 4, 5 #> 13 ME, RS, MT, LU, CY, DE1, DE2, DE3, DE4, DE5, DE6, DE7, DE8, DE9, FR9, DEA, DEB, DEC, UKC, ITC, DED, UKD, DEE, UKE, DEF, UKF, ITF, DEG, UKG, ITG, UKH, ITH, UKI, ITI, UKJ, UKK, UKL, UKM, UKN, BE10, FR10, TR10, HU10, PT20, EL30, FR30, ES30, PT30, ES70, TR90, DK01, SK01, CZ01, SE11, EL11, NL11, PL11, RO11, ES11, AT11, PT11, BE21, SE21, EL21, NL21, PL21, RO21, FR21, TR21, ES21, AT21, HU21, BE31, SE31, BG31, NL31, PL31, RO31, TR31, AT31, HU31, BG41, EL41, NL41, PL41, RO41, FR41, TR41, ES41, PL51, FR51, TR51, ES51, PL61, FR61, TR61, ES61, FR71, TR71, FR81, TR81, TRA1, TRB1, TRC1, DK02, SK02, CZ02, SE12, EL12, NL12, PL12, RO12, ES12, AT12, BE22, SE22, EL22, NL22, PL22, RO22, FR22, TR22, ES22, AT22, HU22, BE32, SE32, BG32, NL32, PL32, RO32, TR32, AT32, HU32, BG42, EL42, NL42, PL42, RO42, FR42, TR42, ES42, PL52, FR52, TR52, ES52, PL62, FR62, TR62, ES62, FR72, TR72, FR82, TR82, TRA2, TRB2, TRC2, DK03, SK03, CZ03, EL13, NL13, ES13, AT13, BE23, SE23, EL23, NL23, FR23, ES23, HU23, BE33, SE33, BG33, NL33, PL33, TR33, AT33, HU33, EL43, PL43, FR43, ES43, FR53, ES53, PL63, FR63, TR63, ES63, FR83, TR83, TRC3, DK04, SK04, CZ04, EL14, BE24, EL24, FR24, ES24, BE34, BG34, NL34, PL34, AT34, ES64, DK05, CZ05, PT15, BE25, EL25, FR25, BE35, CZ06, PT16, FR26, CZ07, PT17, CZ08, PT18, FI19, FI1B, FI1C, FI1D, FI200, EE001, MK001, LT001, IE011, SI011, AL011, IE021, SI021, AL021, AL031, HR031, HR041, MK002, LT002, IE012, SI012, AL012, IE022, SI022, AL022, AL032, HR032, HR042, MK003, LT003, LV003, IE013, SI013, AL013, IE023, SI023, AL033, HR033, HR043, EE004, MK004, LT004, SI014, AL014, IE024, SI024, AL034, HR034, HR044, MK005, LT005, LV005, SI015, AL015, IE025, AL035, HR035, HR045, EE006, MK006, LT006, LV006, SI016, HR036, HR046, EE007, MK007, LT007, LV007, SI017, HR037, HR047, EE008, MK008, LT008, LV008, SI018, HR048, LT009, LV009, HR049, LT00A, HR04A, HR04B, HR04C, CYTCC, HR04D, HR04E #> 14 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 97 #> 15 0, 2, 89, 97, 98, 99 #> 16 1, 2, 3 #> 17 1, 2, 3, 7 #> 18 1, 2, 3, 9 #> 19 1, 2, 3 #> 20 1, 2, 3 #> 21 1, 2, 3 #> 22 1, 2, 3 #> 23 1, 2, 3 #> 24 1, 2, 3 #> 25 1, 2, 3 #> 26 1, 2, 3 #> 27 1, 2, 3 #> 28 1, 2, 3 #> 29 1, 2, 3 #> 30 1, 2, 3 #> 31 1, 2, 3 #> 32 1, 2, 3 #> 33 1, 2, 3 #> 34 1, 2, 3 #> 35 1, 2, 3 #> 36 1, 2, 3 #> 37 1, 2, 3 #> 38 0, 1 #> 39 0, 1 #> 40 0, 1 #> 41 0, 1 #> 42 0, 1 #> 43 0, 1 #> 44 0, 1 #> 45 0, 1 #> 46 0, 1 #> 47 0, 1 #> 48 0, 1 #> 49 0, 1 #> 50 0, 1 #> 51 0, 1 #> 52 1, 2, 3, 4, 5, 6 #> 53 1, 2, 3, 4, 5, 6 #> 54 NA #> 55 NA #> 56 NA #> na_labels na_range n_labels n_valid_labels n_na_labels #> 1 NA NA 0 0 0 #> 2 NA NA 0 0 0 #> 3 NA NA 0 0 0 #> 4 NA NA 0 0 0 #> 5 NA NA 0 0 0 #> 6 NA NA 0 0 0 #> 7 NA NA 0 0 0 #> 8 NA 21 21 0 #> 9 NA 7 7 0 #> 10 999 NA 26 25 1 #> 11 NA 5 5 0 #> 12 NA 5 5 0 #> 13 NA 308 308 0 #> 14 NA 16 16 0 #> 15 NA 6 6 0 #> 16 8 NA 4 3 1 #> 17 NA 4 4 0 #> 18 NA 4 4 0 #> 19 9 NA 4 3 1 #> 20 9 NA 4 3 1 #> 21 9 NA 4 3 1 #> 22 9 NA 4 3 1 #> 23 9 NA 4 3 1 #> 24 9 NA 4 3 1 #> 25 9 NA 4 3 1 #> 26 9 NA 4 3 1 #> 27 9 NA 4 3 1 #> 28 9 NA 4 3 1 #> 29 9 NA 4 3 1 #> 30 9 NA 4 3 1 #> 31 9 NA 4 3 1 #> 32 9 NA 4 3 1 #> 33 9 NA 4 3 1 #> 34 9 NA 4 3 1 #> 35 9 NA 4 3 1 #> 36 9 NA 4 3 1 #> 37 9 NA 4 3 1 #> 38 9 NA 3 2 1 #> 39 9 NA 3 2 1 #> 40 9 NA 3 2 1 #> 41 9 NA 3 2 1 #> 42 9 NA 3 2 1 #> 43 9 NA 3 2 1 #> 44 9 NA 3 2 1 #> 45 9 NA 3 2 1 #> 46 9 NA 3 2 1 #> 47 9 NA 3 2 1 #> 48 9 NA 3 2 1 #> 49 9 NA 3 2 1 #> 50 9 NA 3 2 1 #> 51 9 NA 3 2 1 #> 52 9, 99 NA 8 6 2 #> 53 9, 99 NA 8 6 2 #> 54 NA NA 0 0 0 #> 55 NA NA 0 0 0 #> 56 NA NA 0 0 0