Using the CEOdata package

Xavier Fernández-i-Marín

17/03/2022 - Version 1.0.2

CEOdata is a package that facilitates the incorporation of microdata (individual responses) of public opinion polls in Catalonia into R, as performed by the “Centre d’Estudis d’Opinió” (CEO, Opinion Studies Center). It has basically three main functions with a separate purpose:

CEOdata(): Get the survey data

The most comprehensive kind of data on Catalan public opinion is the “Barometer”, that can be retrieved by default by the main function CEOdata().

library(CEOdata)
d <- CEOdata()

This provides a cleaned and merged version of all the available Barometers, since 2017, providing easy access to the following number of responses and variables:

dim(d)
## [1] 33838   814
d
## # A tibble: 33,838 × 814
##    PONDERA ORDRE_REVISADA   REO BOP_NUM   ANY   MES   DIA HOR_INI HOR_FIN DURADA
##      <dbl>          <dbl> <dbl> <fct>   <dbl> <dbl> <dbl>   <dbl>   <dbl>  <dbl>
##  1    1.86              1   746 Març 1…  2014     3    NA      NA      NA   1631
##  2    1.86              2   746 Març 1…  2014     3    NA      NA      NA   1972
##  3    1.86              3   746 Març 1…  2014     3    NA      NA      NA   1478
##  4    1.86              4   746 Març 1…  2014     3    NA      NA      NA    872
##  5    1.86              5   746 Març 1…  2014     3    NA      NA      NA   1356
##  6    1.86              6   746 Març 1…  2014     3    NA      NA      NA   1205
##  7    1.86              7   746 Març 1…  2014     3    NA      NA      NA   1279
##  8    1.86              8   746 Març 1…  2014     3    NA      NA      NA    995
##  9    1.86              9   746 Març 1…  2014     3    NA      NA      NA   1497
## 10    1.86             10   746 Març 1…  2014     3    NA      NA      NA   1221
## # … with 33,828 more rows, and 804 more variables: ENQUESTADOR_CODI <dbl>,
## #   ENQUESTADOR_SEXE <fct>, ENQUESTADOR_ESTUDIS <fct>,
## #   ENQUESTADOR_NACIONALITAT <fct>, PROVINCIA <fct>, HABITAT <fct>,
## #   MUNICIPI <fct>, COMARCA <fct>, ID_RUTA <dbl>, SECCIO_TEORICA <dbl>,
## #   CONF_SECC <fct>, SECCIO_REAL <dbl>, DOMICILI_PARTICULAR <fct>,
## #   LLENGUA_ENQUESTA <fct>, PADRO <fct>, CIUTADANIA <fct>, SEXE <fct>,
## #   EDAT <dbl>, EDAT_GR <fct>, EDAT_CEO <fct>, LLOC_NAIX <fct>, …
names(d)[1:50]
##  [1] "PONDERA"                  "ORDRE_REVISADA"          
##  [3] "REO"                      "BOP_NUM"                 
##  [5] "ANY"                      "MES"                     
##  [7] "DIA"                      "HOR_INI"                 
##  [9] "HOR_FIN"                  "DURADA"                  
## [11] "ENQUESTADOR_CODI"         "ENQUESTADOR_SEXE"        
## [13] "ENQUESTADOR_ESTUDIS"      "ENQUESTADOR_NACIONALITAT"
## [15] "PROVINCIA"                "HABITAT"                 
## [17] "MUNICIPI"                 "COMARCA"                 
## [19] "ID_RUTA"                  "SECCIO_TEORICA"          
## [21] "CONF_SECC"                "SECCIO_REAL"             
## [23] "DOMICILI_PARTICULAR"      "LLENGUA_ENQUESTA"        
## [25] "PADRO"                    "CIUTADANIA"              
## [27] "SEXE"                     "EDAT"                    
## [29] "EDAT_GR"                  "EDAT_CEO"                
## [31] "LLOC_NAIX"                "HORA_PRIMERA_PREGUNTA"   
## [33] "GRAVACIO"                 "TIPUS_GRAV"              
## [35] "PRE_PROBLEMES"            "PROBLEMES_LITERALS"      
## [37] "PROBLEMES_R_1"            "PROBLEMES_R_2"           
## [39] "PROBLEMES_R_3"            "PROBLEMES_R_4"           
## [41] "PROBLEMES_R_5"            "PROBLEMES_R_6"           
## [43] "PROBLEMES_R_7"            "PROBLEMES_R_8"           
## [45] "PROBLEMES_R_9"            "PROBLEMES_R_10"          
## [47] "PROBLEMES_R_11"           "PROBLEMES_R_12"          
## [49] "PROBLEMES_E_1"            "PROBLEMES_E_2"

Specific studies or time frames

CEOdata() allows you to select specific Barometers, by providing their internal register in the reo argument. The reo is the internal name that the CEO uses, and stands for “Registre d’Estudis d’Opinió” (register of opinion studies), and is the main identifier of the survey, also present in the table of meta data. Although many of them are numbers, some have a number, a slash and another number, and therefore a character vector must be passed. Only a single REO can be passed, as it is not guaranteed that different data matrices share any column, and may refer to very different topics.

For instance, to get only the data of the study with register “746” (corresponding to March 2013):

d746 <- CEOdata(reo = "746")
d746
## # A tibble: 2,000 × 475
##      NUM NUM_CINE      BOP_NUM   MES   ANY   DIA CODI_ENQ HOR_INI HOR_FIN DURADA
##    <dbl>    <dbl>    <dbl+lbl> <dbl> <dbl> <dbl> <dbl+lb> <time>  <time>   <dbl>
##  1    NA        1 32 [Març. 1…     4    14    NA 243 [G3]    NA      NA     1203
##  2    NA        2 32 [Març. 1…     4    14    NA 254 [T4]    NA      NA      997
##  3    NA        3 32 [Març. 1…     4    14    NA 243 [G3]    NA      NA     1127
##  4    NA        4 32 [Març. 1…     4    14    NA 235 [B5]    NA      NA     1792
##  5    NA        5 32 [Març. 1…     4    14    NA 236 [B6]    NA      NA     1418
##  6    NA        6 32 [Març. 1…     3    14    NA 246 [L1]    NA      NA     1964
##  7    NA        7 32 [Març. 1…     4    14    NA 244 [G4]    NA      NA     2283
##  8    NA        8 32 [Març. 1…     4    14    NA 233 [B3]    NA      NA     1322
##  9    NA        9 32 [Març. 1…     3    14    NA 232 [B2]    NA      NA     1778
## 10    NA       10 32 [Març. 1…     3    14    NA 254 [T4]    NA      NA     1119
## # … with 1,990 more rows, and 465 more variables: num_quest <dbl>,
## #   sexe_enq <dbl+lbl>, edat_enq <dbl>, estudis_enq <dbl+lbl>,
## #   nacionalitat_enq <dbl+lbl>, PROVI <dbl+lbl>, HABITAT <dbl+lbl>,
## #   MUN <dbl+lbl>, ADRECA <chr>, COMARCA <dbl+lbl>, SEXE <dbl+lbl>, EDAT <dbl>,
## #   SE <chr>, GR_EDAT <dbl+lbl>, Edat_CEO <dbl+lbl>, F01 <dbl+lbl>,
## #   F02 <dbl+lbl>, F03 <dbl+lbl>, F04 <dbl+lbl>, PRE_P1 <dbl+lbl>,
## #   P1_LITERALS <chr>, P1_100_R <dbl>, P1_200_R <dbl>, P1_300_R <dbl>, …

Not all studies carried on by the CEO (and therefore listed in the CEOmeta() function –see below–) have microdata available. For convenience, there is a variable in the metadata that returns whether the microdata is available or not (microdata_available).

When using the kind argument (which is the default), the function CEOdata() also allows to restrict the whole set of barometers based on specific time frames defined by a date with the arguments date_start and date_end using the YYYY-MM-DD format. Notice that only the barometers are considered when using this arguments, not other studies.

b2019 <- CEOdata(date_start = "2019-01-01", date_end = "2019-12-31")
## Downloading the barometer.
## Converting the original data into R. This may take a while.
## Post-processing the data. This may take a while.
b2019
## # A tibble: 4,500 × 814
##    PONDERA ORDRE_REVISADA   REO BOP_NUM   ANY   MES   DIA HOR_INI HOR_FIN DURADA
##      <dbl>          <dbl> <dbl> <fct>   <dbl> <dbl> <dbl>   <dbl>   <dbl>  <dbl>
##  1       1              1   919 Març 1…  2019     3    NA      NA      NA   1657
##  2       1              2   919 Març 1…  2019     3    NA      NA      NA   1680
##  3       1              3   919 Març 1…  2019     3    NA      NA      NA   1757
##  4       1              4   919 Març 1…  2019     3    NA      NA      NA   1645
##  5       1              5   919 Març 1…  2019     3    NA      NA      NA   1704
##  6       1              6   919 Març 1…  2019     3    NA      NA      NA   1645
##  7       1              7   919 Març 1…  2019     3    NA      NA      NA   6722
##  8       1              8   919 Març 1…  2019     3    NA      NA      NA   1720
##  9       1              9   919 Març 1…  2019     3    NA      NA      NA   1709
## 10       1             10   919 Març 1…  2019     3    NA      NA      NA   1929
## # … with 4,490 more rows, and 804 more variables: ENQUESTADOR_CODI <dbl>,
## #   ENQUESTADOR_SEXE <fct>, ENQUESTADOR_ESTUDIS <fct>,
## #   ENQUESTADOR_NACIONALITAT <fct>, PROVINCIA <fct>, HABITAT <fct>,
## #   MUNICIPI <fct>, COMARCA <fct>, ID_RUTA <dbl>, SECCIO_TEORICA <dbl>,
## #   CONF_SECC <fct>, SECCIO_REAL <dbl>, DOMICILI_PARTICULAR <fct>,
## #   LLENGUA_ENQUESTA <fct>, PADRO <fct>, CIUTADANIA <fct>, SEXE <fct>,
## #   EDAT <dbl>, EDAT_GR <fct>, EDAT_CEO <fct>, LLOC_NAIX <fct>, …

Extra variables

By default CEOdata() incorporates new variables to the original matrix. Variables that are created for convenience, such as the date of the survey. The CEO data not always provides a day of the month. In that case, 28 is used. These variables appear at the end of the dataset and can be distinguished from the original CEO variables because only the first letter is capitalized.

tail(names(d))
## [1] "CONSEQ_ECON_COVID19"     "ACTITUD_PERSONAL_COVD19"
## [3] "CIRCUIT_985_1"           "CIRCUIT_985_2"          
## [5] "CIRCUIT_985_3"           "Data"

In case of desiring all variable names to be lowercase, one can simply convert them with tolower():

d.lowercase <- d
names(d.lowercase) <- tolower(names(d.lowercase))

CEOmeta(): Access to the metadata of studies and surveys

The function CEOmeta allows to easily retrieve, search and restrict by time the list of all the surveys produced by the CEO, which amounts to more than a thousand as of early 2022.

When called alone, the function downloads the latest version of the metadata published by the center, in a transparent way, and caching its content so that any subsequent calls in the same R session do not need to download it again.

CEOmeta()
## # A tibble: 1,152 × 28
##    REO   `Titol enquesta`    `Titol estudi`    `Metodologia en… `Metode de reco…
##    <fct> <chr>               <chr>             <fct>            <fct>           
##  1 1006  Seguiment d'indica… Seguiment d'indi… quantitativa     telèfon         
##  2 1005  Enquesta sobre el … Enquesta sobre e… quantitativa     telèfon         
##  3 1004  Baròmetre sanitari… Baròmetre sanita… quantitativa     telèfon         
##  4 1003  L'ètica pública a … L'ètica pública … quantitativa     autoadministrada
##  5 1002  Enquesta de satisf… Enquesta de sati… quantitativa     autoadministrada
##  6 1001  Índex de satisfacc… Índex de satisfa… quantitativa     internet;telèfon
##  7 1000  Enquesta panel sob… Enquesta panel s… quantitativa     internet        
##  8 999   Enquesta d'inserci… Enquesta d'inser… quantitativa     telèfon         
##  9 998   Hàbits de consum d… Hàbits de consum… quantitativa     telèfon         
## 10 997   Hàbits de consum d… Hàbits de consum… quantitativa     telèfon         
## # … with 1,142 more rows, and 23 more variables: Objectius <chr>,
## #   Ambit territorial <fct>, Cost <dbl>, Promotors enquesta <chr>,
## #   Executors enquesta <chr>, Promotors estudi <chr>, Executors estudi <chr>,
## #   Data de treball de camp <chr>, Dia inici treball de camp <date>,
## #   Dia final treball de camp <date>, Univers <chr>, Mostra <chr>,
## #   Mostra estudis quantitatius <dbl>, Mostra estudis qualitatius <chr>,
## #   Error mostral <chr>, Error mostral (numèric) <chr>, Resum <chr>, …

Get a specific study

In order to get the metadata of a specific study, the reo argument can be used:

CEOmeta(reo = "746")
## # A tibble: 1 × 28
##   REO   `Titol enquesta`    `Titol estudi`    `Metodologia en… `Metode de recol…
##   <fct> <chr>               <chr>             <fct>            <fct>            
## 1 746   Baròmetre d'Opinió… Baròmetre d'Opin… quantitativa     presencial       
## # … with 23 more variables: Objectius <chr>, Ambit territorial <fct>,
## #   Cost <dbl>, Promotors enquesta <chr>, Executors enquesta <chr>,
## #   Promotors estudi <chr>, Executors estudi <chr>,
## #   Data de treball de camp <chr>, Dia inici treball de camp <date>,
## #   Dia final treball de camp <date>, Univers <chr>, Mostra <chr>,
## #   Mostra estudis quantitatius <dbl>, Mostra estudis qualitatius <chr>,
## #   Error mostral <chr>, Error mostral (numèric) <chr>, Resum <chr>, …

Search for specific topics though keywords

The first relevant argument for CEOmeta() is search, which is a built-in simple search engine that goes through the columns of the metadata containing potential descriptive information (title, summary, objectives and tags -descriptors-) and returns the studies that contain such keyword.

CEOmeta(search = "Medi ambient")
## Looking for entries with: medi ambient
## # A tibble: 45 × 28
##    REO   `Titol enquesta`    `Titol estudi`    `Metodologia en… `Metode de reco…
##    <fct> <chr>               <chr>             <fct>            <fct>           
##  1 1006  Seguiment d'indica… Seguiment d'indi… quantitativa     telèfon         
##  2 973   Seguiment d'indica… Seguiment d'indi… quantitativa     telèfon         
##  3 941   Seguiment d'indica… Seguiment d'indi… quantitativa     telèfon         
##  4 876   Baròmetre de la bi… Baròmetre de la … quantitativa     internet;telèfon
##  5 875   Seguiment d'indica… Seguiment d'indi… quantitativa     telèfon         
##  6 865   Seguiment d'indica… Seguiment d'indi… quantitativa     telèfon         
##  7 819   Baròmetre 2015 de … Baròmetre 2015 d… quantitativa     telèfon         
##  8 807   Seguiment d'Indica… Seguiment d'indi… quantitativa     telèfon         
##  9 805   Baròmetre de la bi… Baròmetre de la … quantitativa     internet;telèfon
## 10 803   Post test campanya… Post test campan… quantitativa     telèfon         
## # … with 35 more rows, and 23 more variables: Objectius <chr>,
## #   Ambit territorial <fct>, Cost <dbl>, Promotors enquesta <chr>,
## #   Executors enquesta <chr>, Promotors estudi <chr>, Executors estudi <chr>,
## #   Data de treball de camp <chr>, Dia inici treball de camp <date>,
## #   Dia final treball de camp <date>, Univers <chr>, Mostra <chr>,
## #   Mostra estudis quantitatius <dbl>, Mostra estudis qualitatius <chr>,
## #   Error mostral <chr>, Error mostral (numèric) <chr>, Resum <chr>, …

It is also possible to pass more than one value to search, so that the search includes them (either one of them OR any other).

CEOmeta(search = c("Medi ambient", "Municipi"))
## Looking for entries with: medi ambient OR municipi
## # A tibble: 49 × 28
##    REO   `Titol enquesta`    `Titol estudi`    `Metodologia en… `Metode de reco…
##    <fct> <chr>               <chr>             <fct>            <fct>           
##  1 1006  Seguiment d'indica… Seguiment d'indi… quantitativa     telèfon         
##  2 973   Seguiment d'indica… Seguiment d'indi… quantitativa     telèfon         
##  3 941   Seguiment d'indica… Seguiment d'indi… quantitativa     telèfon         
##  4 876   Baròmetre de la bi… Baròmetre de la … quantitativa     internet;telèfon
##  5 875   Seguiment d'indica… Seguiment d'indi… quantitativa     telèfon         
##  6 865   Seguiment d'indica… Seguiment d'indi… quantitativa     telèfon         
##  7 819   Baròmetre 2015 de … Baròmetre 2015 d… quantitativa     telèfon         
##  8 807   Seguiment d'Indica… Seguiment d'indi… quantitativa     telèfon         
##  9 805   Baròmetre de la bi… Baròmetre de la … quantitativa     internet;telèfon
## 10 803   Post test campanya… Post test campan… quantitativa     telèfon         
## # … with 39 more rows, and 23 more variables: Objectius <chr>,
## #   Ambit territorial <fct>, Cost <dbl>, Promotors enquesta <chr>,
## #   Executors enquesta <chr>, Promotors estudi <chr>, Executors estudi <chr>,
## #   Data de treball de camp <chr>, Dia inici treball de camp <date>,
## #   Dia final treball de camp <date>, Univers <chr>, Mostra <chr>,
## #   Mostra estudis quantitatius <dbl>, Mostra estudis qualitatius <chr>,
## #   Error mostral <chr>, Error mostral (numèric) <chr>, Resum <chr>, …

In addition to the built-in argument to search through the columns of the survey title, the study title, the objectives, the summary and the tags (descriptors), it is possible to combine CEOmeta() with dplyr’s filter() to limit the results of studies returned.

For example, to get the studies that have been performed using Internet to get the data:

CEOmeta() |> 
  filter(`Metode de recollida de dades` == "internet")
## # A tibble: 36 × 28
##    REO   `Titol enquesta`    `Titol estudi`    `Metodologia en… `Metode de reco…
##    <fct> <chr>               <chr>             <fct>            <fct>           
##  1 1000  Enquesta panel sob… Enquesta panel s… quantitativa     internet        
##  2 995   Enquesta de satisf… Enquesta de sati… quantitativa     internet        
##  3 993   Enquesta de satisf… Enquesta de sati… quantitativa     internet        
##  4 989   Enquesta de satisf… Enquesta de sati… quantitativa     internet        
##  5 969   Estudi de percepci… Estudi de percep… quantitativa     internet        
##  6 968   Estudi de percepci… Estudi de percep… quantitativa     internet        
##  7 966   Enquesta sobre els… Enquesta sobre e… quantitativa     internet        
##  8 965   Enquesta sobre l'i… Enquesta sobre l… quantitativa     internet        
##  9 961   Enquesta de satisf… Enquesta de sati… quantitativa     internet        
## 10 953   Enquesta de satisf… Enquesta de sati… quantitativa     internet        
## # … with 26 more rows, and 23 more variables: Objectius <chr>,
## #   Ambit territorial <fct>, Cost <dbl>, Promotors enquesta <chr>,
## #   Executors enquesta <chr>, Promotors estudi <chr>, Executors estudi <chr>,
## #   Data de treball de camp <chr>, Dia inici treball de camp <date>,
## #   Dia final treball de camp <date>, Univers <chr>, Mostra <chr>,
## #   Mostra estudis quantitatius <dbl>, Mostra estudis qualitatius <chr>,
## #   Error mostral <chr>, Error mostral (numèric) <chr>, Resum <chr>, …

Or to get studies with a specific quantitative sample size limit:

CEOmeta() |>
  filter(`Mostra estudis quantitatius` < 500)
## # A tibble: 170 × 28
##    REO   `Titol enquesta`    `Titol estudi`    `Metodologia en… `Metode de reco…
##    <fct> <chr>               <chr>             <fct>            <fct>           
##  1 990   IPLAENSA Opinió i … IPLAENSA Opinió … quantitativa     telèfon         
##  2 989   Enquesta de satisf… Enquesta de sati… quantitativa     internet        
##  3 984   iPLAENSA Satisfacc… iPLAENSA Satisfa… quantitativa     telèfon         
##  4 983   iPLAENSA: Satisfac… iPLAENSA: Satisf… quantitativa     telèfon         
##  5 964   Enquesta satisfacc… Enquesta satisfa… quantitativa     autoadministrada
##  6 963   Enquesta satisfacc… Enquesta satisfa… quantitativa     autoadministrada
##  7 957   Avaluació del grau… Avaluació del gr… quantitativa     presencial      
##  8 950   Enquesta de satisf… Enquesta de sati… quantitativa     telèfon         
##  9 933   iPLAENSA: Enquesta… iPLAENSA: Enques… quantitativa     telèfon         
## 10 930   iPLAENSA: Satisfac… iPLAENSA: Satisf… quantitativa     telèfon         
## # … with 160 more rows, and 23 more variables: Objectius <chr>,
## #   Ambit territorial <fct>, Cost <dbl>, Promotors enquesta <chr>,
## #   Executors enquesta <chr>, Promotors estudi <chr>, Executors estudi <chr>,
## #   Data de treball de camp <chr>, Dia inici treball de camp <date>,
## #   Dia final treball de camp <date>, Univers <chr>, Mostra <chr>,
## #   Mostra estudis quantitatius <dbl>, Mostra estudis qualitatius <chr>,
## #   Error mostral <chr>, Error mostral (numèric) <chr>, Resum <chr>, …

Restrict by time

Metadata can be retrieved for a specific period of time, by using the arguments date_start and date_end, also using the YYYY-MM-DD format. In this case the dates that are taken into account are dates where the study gets into the records, not the fieldwork dates.

CEOmeta(date_start = "2019-01-01", date_end = "2019-12-31")
## # A tibble: 45 × 28
##    REO   `Titol enquesta`    `Titol estudi`    `Metodologia en… `Metode de reco…
##    <fct> <chr>               <chr>             <fct>            <fct>           
##  1 954   Baròmetre d'Opinió… Baròmetre d'Opin… quantitativa     presencial      
##  2 953   Enquesta de satisf… Enquesta de sati… quantitativa     internet        
##  3 952   Percepció sobre el… Percepció sobre … quantitativa     presencial      
##  4 951   Cosmopolitisme i l… Cosmopolitisme i… quantitativa     presencial      
##  5 950   Enquesta de satisf… Enquesta de sati… quantitativa     telèfon         
##  6 949   Enquesta sobre civ… Enquesta sobre c… quantitativa     internet;presen…
##  7 948   Enquesta sobre el … Enquesta sobre e… quantitativa     telèfon         
##  8 947   Baròmetre sanitari… Baròmetre sanita… quantitativa     telèfon         
##  9 946   Òmnibus de la Gene… Òmnibus de la Ge… quantitativa     presencial      
## 10 945   Baròmetre de satis… Baròmetre de sat… quantitativa     internet        
## # … with 35 more rows, and 23 more variables: Objectius <chr>,
## #   Ambit territorial <fct>, Cost <dbl>, Promotors enquesta <chr>,
## #   Executors enquesta <chr>, Promotors estudi <chr>, Executors estudi <chr>,
## #   Data de treball de camp <chr>, Dia inici treball de camp <date>,
## #   Dia final treball de camp <date>, Univers <chr>, Mostra <chr>,
## #   Mostra estudis quantitatius <dbl>, Mostra estudis qualitatius <chr>,
## #   Error mostral <chr>, Error mostral (numèric) <chr>, Resum <chr>, …

Browse the CEO site

In addition, to the search engine and the restriction by time CEOmeta() also allows to automatically open the relevant URLs at the CEO domain that contain the details of the studies gathered with the function. This can be done setting the browse argument to TRUE. However, there is a soft limitation of only 10 URLs to be opened, unless the user forces to really open all of them (proceed with caution, as this may open many tabs in your browser and leave your computer out of RAM in some scenarios of RAM black holes, such as Chrome).

CEOmeta(search = "Medi ambient a", browse = TRUE)

To open a specific REO, a simpler call with its specific identifier can be used:

CEOmeta(reo = "746", browse = TRUE)

It is also possible to specify an alternative language, so the default Catalan pages are substituted by the automatic translations provided by Apertium (for Occitan/Aranese) or Google Translate.

CEOmeta(search = "Medi ambient a", browse = TRUE, browse_translate = "de")

CEOsearch(): Access to the variable and value labels

Contrary to CEOdata() and CEOmeta(), CEOsearch() needs at least one argument: the survey data (microdata) for which we want to extract the variable labels and the value labels. By default it provides the variable labels in a tidy object:

CEOsearch(d)  # equivalent to CEOsearch(d, where = "variables")
## # A tibble: 814 × 2
##    Variable       Label                                                  
##    <chr>          <chr>                                                  
##  1 PONDERA        Coeficients de ponderació                              
##  2 ORDRE_REVISADA Número d'ordre de registre original                    
##  3 REO            Número de registre                                     
##  4 BOP_NUM        Número d'ordre del baròmetre                           
##  5 ANY            Any de realització del baròmetre                       
##  6 MES            Mes de realització del baròmetre                       
##  7 DIA            Dia (variable anonimitzada)                            
##  8 HOR_INI        Hora de inicio de la entrevista (variable anonimitzada)
##  9 HOR_FIN        Hora de fin de la entrevista (variable anonimitzada)   
## 10 DURADA         Durada de l'entrevista en segons                       
## # … with 804 more rows

Equivalently, the use of where = "values" provides with a tidy object containing the value labels. Notice that in this case the variable names are repeated to accommodate each of the different value labels.

CEOsearch(d, where = "values")
## # A tibble: 10,263 × 2
##    Variable Value        
##    <fct>    <fct>        
##  1 BOP_NUM  Març 14 - 746
##  2 BOP_NUM  Oct. 14 -758 
##  3 BOP_NUM  Feb 15 -774  
##  4 BOP_NUM  Juny 15 -795 
##  5 BOP_NUM  Oct. 15 -804 
##  6 BOP_NUM  Feb. 16 -816 
##  7 BOP_NUM  Juny 16 -826 
##  8 BOP_NUM  Oct. 16 -835 
##  9 BOP_NUM  Març 17 -850 
## 10 BOP_NUM  Juny 17 -857 
## # … with 10,253 more rows

Just like with the CEOmeta(), CEOsearch() has a simple built-in search facility that allows to retrieve only the rows that match a specific keyword(s). In the following example, we restrict the variables to those that contain “edat” (age).

CEOsearch(d, keyword = "edat")
## Looking for entries with: edat
## # A tibble: 14 × 2
##    Variable            Label                                                    
##    <chr>               <chr>                                                    
##  1 EDAT                Edat                                                     
##  2 EDAT_GR             Grups d'edat                                             
##  3 EDAT_CEO            Grups d'edat reagrupada (recodificació grups de 5 anys)  
##  4 CRISI_ATUR_FAMILIAR En els últims dos anys, com a conseqüència de la crisi, …
##  5 EDAT_1              Edat. Persona 1 (variable anonimitzada)                  
##  6 EDAT_2              Edat. Persona 2 (variable anonimitzada)                  
##  7 EDAT_3              Edat. Persona 3 (variable anonimitzada)                  
##  8 EDAT_4              Edat. Persona 4 (variable anonimitzada)                  
##  9 EDAT_5              Edat. Persona 5 (variable anonimitzada)                  
## 10 EDAT_6              Edat. Persona 6 (variable anonimitzada)                  
## 11 EDAT_7              Edat. Persona 7 (variable anonimitzada)                  
## 12 EDAT_8              Edat. Persona 8 (variable anonimitzada)                  
## 13 EDAT_9              Edat. Persona 9 (variable anonimitzada)                  
## 14 EDAT_10             Edat. Persona 10 (variable anonimitzada)

Finally, an English translation of the variable labels/values is provided if the argument translate is set to TRUE.

CEOsearch(d, keyword = "edat", translate = TRUE)
## Looking for entries with: edat
## # A tibble: 14 × 2
##    Variable            Label                                                    
##    <chr>               <chr>                                                    
##  1 EDAT                Edat                                                     
##  2 EDAT_GR             Grups d'edat                                             
##  3 EDAT_CEO            Grups d'edat reagrupada (recodificació grups de 5 anys)  
##  4 CRISI_ATUR_FAMILIAR En els últims dos anys, com a conseqüència de la crisi, …
##  5 EDAT_1              Edat. Persona 1 (variable anonimitzada)                  
##  6 EDAT_2              Edat. Persona 2 (variable anonimitzada)                  
##  7 EDAT_3              Edat. Persona 3 (variable anonimitzada)                  
##  8 EDAT_4              Edat. Persona 4 (variable anonimitzada)                  
##  9 EDAT_5              Edat. Persona 5 (variable anonimitzada)                  
## 10 EDAT_6              Edat. Persona 6 (variable anonimitzada)                  
## 11 EDAT_7              Edat. Persona 7 (variable anonimitzada)                  
## 12 EDAT_8              Edat. Persona 8 (variable anonimitzada)                  
## 13 EDAT_9              Edat. Persona 9 (variable anonimitzada)                  
## 14 EDAT_10             Edat. Persona 10 (variable anonimitzada)

Of course, variable labels and values can be merged into a single object using a combination of join and CEOsearch():

CEOsearch(d) |>
  left_join(CEOsearch(d, where = "values"))
## Joining, by = "Variable"
## # A tibble: 10,328 × 3
##    Variable       Label                               Value        
##    <chr>          <chr>                               <fct>        
##  1 PONDERA        Coeficients de ponderació           <NA>         
##  2 ORDRE_REVISADA Número d'ordre de registre original <NA>         
##  3 REO            Número de registre                  <NA>         
##  4 BOP_NUM        Número d'ordre del baròmetre        Març 14 - 746
##  5 BOP_NUM        Número d'ordre del baròmetre        Oct. 14 -758 
##  6 BOP_NUM        Número d'ordre del baròmetre        Feb 15 -774  
##  7 BOP_NUM        Número d'ordre del baròmetre        Juny 15 -795 
##  8 BOP_NUM        Número d'ordre del baròmetre        Oct. 15 -804 
##  9 BOP_NUM        Número d'ordre del baròmetre        Feb. 16 -816 
## 10 BOP_NUM        Número d'ordre del baròmetre        Juny 16 -826 
## # … with 10,318 more rows

Development and acknowledgement

The development of CEOdata (track changes, propose improvements, report bugs) can be followed at github.

If using the data and the package, please cite and acknowledge properly the CEO and the package, respectively.