library(eurobarometer)
library(dplyr)

The ZA7562_sample is a small fraction of the GESIS datafile ZA5479_v6-0-0.sav. It cannot be used to retrieve any statistical data from the original dataset. In scope it is limited to some important metadata columns, a few demographic variables and one question block. In geographic coverage, it takes a sample from the responses from the United Kingdom and Germany. These two countries are targeting parts of the countries separately, i.e. for Great Britain and Northern Ireland, and the former West Germany and East Germany.

ZA7576_sample <- read_rds(
  system.file("examples", "ZA7576.rds", package="eurobarometer")
)
#> Survey read:
#> id: ZA7576
#> filename: ZA7576.rds
#> doi: doi:10.4232/1.13393

When you read data in with read_rds() or read_spss(), as many metadata is added to the survey data frame as possible.

attributes(ZA7576_sample)
#> $names
#>  [1] "rowid"    "doi"      "version"  "uniqid"   "caseid"   "serialid"
#>  [7] "isocntry" "p1"       "p2"       "p3"       "p4"       "p5"      
#> [13] "nuts"     "d7"       "d8"       "d25"      "d60"      "qa14_5"  
#> [19] "qa14_3"   "qa14_2"   "qa14_4"   "qa14_1"   "qa6a_5"   "qa6a_10" 
#> [25] "qa6b_2"   "qa6a_3"   "qa6a_1"   "qa6b_4"   "qa6a_8"   "qa6a_9"  
#> [31] "qa6a_4"   "qa6a_2"   "qa6b_1"   "qa6a_6"   "qa6a_7"   "qa6a_11" 
#> [37] "qa6b_3"   "qd6.1"    "qd6.2"    "qd6.3"    "qd6.4"    "qd6.5"   
#> [43] "qd6.6"    "qd6.7"    "qd6.8"    "qd6.9"    "qd6.10"   "qd6.11"  
#> [49] "qd6.12"   "qd6.13"   "qd6.14"   "qg1b"     "qg8"      "w1"      
#> [55] "w3"       "wex"     
#> 
#> $row.names
#>  [1]  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
#> [26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
#> 
#> $class
#> [1] "survey"     "tbl_df"     "tbl"        "data.frame"
#> 
#> $id
#> [1] "ZA7576"
#> 
#> $filename
#> [1] "ZA7576.rds"
#> 
#> $doi
#> [1] "doi:10.4232/1.13393"
#> 
#> $gesis_file_version
#> [1] NA
#> 
#> $wave
#> [1] "Eurobarometer 91.5"
#> 
#> $timeframe
#> [1] "June-July 2019"
#> 
#> $eb_description
#> [1] "Standard Eurobarometer, European Parliament Post-election survey 2019, and EU citizens and development cooperation"

For identifying variables and variable labels, the helper function gesis_metadata_create() analyzes the contents of the survey.

sample_metadata <- gesis_metadata_create(ZA7562_sample)
names(sample_metadata)
#>  [1] "filename"           "qb"                 "var_name_orig"     
#>  [4] "label_orig"         "var_label_norm"     "var_name_suggested"
#>  [7] "n_valid_labels"     "n_na_labels"        "labels"            
#> [10] "na_labels"          "na_range"           "class_orig"

The function gesis_metadta_create() normalizes those variable names that are not machine readable, using two functions under the hood (see: label_normalize() and label_suggest().)

sample_metadata %>%
  select ( all_of(c("var_name_orig", "var_name_suggested")))
#>           var_name_orig                                    var_name_suggested
#> survey.1            doi                                                   doi
#> survey.2        version                        gesis_archive_version_and_date
#> survey.3         uniqid                                                uniqid
#> survey.4       isocntry                                 country_code_iso_3166
#> survey.5             p1                                     date_of_interview
#> survey.6             p2                                     time_of_interview
#> survey.7             p3                                 duration_of_interview
#> survey.8             p4                 n_of_persons_present_during_interview
#> survey.9             p5                                respondent_cooperation
#> survey.10            d7                                        marital_status
#> survey.11            d8                                         age_education
#> survey.12           d25                                     type_of_community
#> survey.13           d60                                paying_bills_last_year
#> survey.14         qa3_6                                  trust_european_union
#> survey.15         qa3_6                                  trust_european_union
#> survey.16         qa3_6                                  trust_european_union
#> survey.17         qa3_6                                  trust_european_union
#> survey.18         qa3_6                                  trust_european_union
#> survey.19         qa3_6                                  trust_european_union
#> survey.20         qa3_6                                  trust_european_union
#> survey.21         qa3_6                                  trust_european_union
#> survey.22         qa3_6                                  trust_european_union
#> survey.23         qa3_1                                           trust_media
#> survey.24         qa3_1                                           trust_media
#> survey.25         qa3_1                                           trust_media
#> survey.26         qa3_1                                           trust_media
#> survey.27         qa3_1                                           trust_media
#> survey.28         qa3_1                                           trust_media
#> survey.29         qa3_1                                           trust_media
#> survey.30         qa3_1                                           trust_media
#> survey.31         qa3_1                                           trust_media
#> survey.32         qa3_4                             trust_national_government
#> survey.33         qa3_4                             trust_national_government
#> survey.34         qa3_4                             trust_national_government
#> survey.35         qa3_4                             trust_national_government
#> survey.36         qa3_4                             trust_national_government
#> survey.37         qa3_4                             trust_national_government
#> survey.38         qa3_4                             trust_national_government
#> survey.39         qa3_4                             trust_national_government
#> survey.40         qa3_4                             trust_national_government
#> survey.41         qa3_5                             trust_national_parliament
#> survey.42         qa3_5                             trust_national_parliament
#> survey.43         qa3_5                             trust_national_parliament
#> survey.44         qa3_5                             trust_national_parliament
#> survey.45         qa3_5                             trust_national_parliament
#> survey.46         qa3_5                             trust_national_parliament
#> survey.47         qa3_5                             trust_national_parliament
#> survey.48         qa3_5                             trust_national_parliament
#> survey.49         qa3_5                             trust_national_parliament
#> survey.50         qa3_2                               trust_political_parties
#> survey.51         qa3_2                               trust_political_parties
#> survey.52         qa3_2                               trust_political_parties
#> survey.53         qa3_2                               trust_political_parties
#> survey.54         qa3_2                               trust_political_parties
#> survey.55         qa3_2                               trust_political_parties
#> survey.56         qa3_2                               trust_political_parties
#> survey.57         qa3_2                               trust_political_parties
#> survey.58         qa3_2                               trust_political_parties
#> survey.59         qa3_3                      trust_regional_local_authorities
#> survey.60         qa3_3                      trust_regional_local_authorities
#> survey.61         qa3_3                      trust_regional_local_authorities
#> survey.62         qa3_3                      trust_regional_local_authorities
#> survey.63         qa3_3                      trust_regional_local_authorities
#> survey.64         qa3_3                      trust_regional_local_authorities
#> survey.65         qa3_3                      trust_regional_local_authorities
#> survey.66         qa3_3                      trust_regional_local_authorities
#> survey.67         qa3_3                      trust_regional_local_authorities
#> survey.68         d71_1                 political_discussion_national_matters
#> survey.69         d71_2                 political_discussion_european_matters
#> survey.70         d71_3                    political_discussion_local_matters
#> survey.71         qc9.1                    vaccine_information_sources_family
#> survey.72         qc9.2                   vaccine_information_sources_friends
#> survey.73         qc9.3                vaccine_information_sources_doctor_etc
#> survey.74         qc9.4 vaccine_information_sources_other_health_care_workers
#> survey.75         qc9.5               vaccine_information_sources_pharmacists
#> survey.76         qc9.6    vaccine_information_sources_online_social_networks
#> survey.77         qc9.7      vaccine_information_sources_other_internet_sites
#> survey.78         qc9.8        vaccine_information_sources_health_authorities
#> survey.79         qc9.9               vaccine_information_sources_other_spont
#> survey.80        qc9.10                vaccine_information_sources_none_spont
#> survey.81        qc9.11                        vaccine_information_sources_dk
#> survey.82          qc10               most_trusted_vaccine_information_source
#> survey.83           d77                 political_discussion_convince_friends
#> survey.84            w1                 weight_result_from_target_redressment
#> survey.85            w3                                        weight_germany
#> survey.86           wex             weight_extrapolated_population_aged_gt_15
#> survey.87      filename                                             not_given