Using the CEOdata package

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(): that provides the data of the surveys directly into R.
  • CEOmeta(): that allows the user to inspect the details of the available surveys (metadata) and to search for specific topics and get the survey details.
  • CEOsearch(): that allows the user to search for variables, variable labels and value labels within a survey data gathered using the CEOdata() function.

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] 51838  1422
d
## # A tibble: 51,838 × 1,422
##    PONDERA ORDRE ORDRE_REVISADA   REO METODOLOGIA BOP_NUM        ANY   MES   DIA
##      <dbl> <dbl>          <dbl> <dbl> <fct>       <fct>        <dbl> <dbl> <dbl>
##  1    1.86     1             NA   746 Presencial  Març 14 - 7…  2014     3    27
##  2    1.86     2             NA   746 Presencial  Març 14 - 7…  2014     3     5
##  3    1.86     3             NA   746 Presencial  Març 14 - 7…  2014     3    11
##  4    1.86     4             NA   746 Presencial  Març 14 - 7…  2014     3    11
##  5    1.86     5             NA   746 Presencial  Març 14 - 7…  2014     3    27
##  6    1.86     6             NA   746 Presencial  Març 14 - 7…  2014     3    28
##  7    1.86     7             NA   746 Presencial  Març 14 - 7…  2014     3     3
##  8    1.86     9             NA   746 Presencial  Març 14 - 7…  2014     3     7
##  9    1.86     8             NA   746 Presencial  Març 14 - 7…  2014     3    25
## 10    1.86    10             NA   746 Presencial  Març 14 - 7…  2014     3    27
## # ℹ 51,828 more rows
## # ℹ 1,413 more variables: HORA_INI <time>, HORA_FIN <time>, DATA_INI <date>,
## #   DATA_FIN <date>, DURADA <dbl>, FASE <fct>, ENQUESTADOR_CODI <dbl>,
## #   ENQUESTADOR_SEXE <fct>, ENQUESTADOR_EDAT <dbl>, ENQUESTADOR_ESTUDIS <fct>,
## #   ENQUESTADOR_NACIONALITAT <fct>, NUM_QUEST_CAMP <dbl>, PROVINCIA <fct>,
## #   HABITAT <fct>, MUNICIPI <fct>, COMARCA <fct>, CLUSTER_21 <dbl>,
## #   ID_RUTA <dbl>, SECCIO_TEORICA <dbl>, CONF_SECC <fct>, SECCIO_REAL <dbl>, …
names(d)[1:50]
##  [1] "PONDERA"                  "ORDRE"                   
##  [3] "ORDRE_REVISADA"           "REO"                     
##  [5] "METODOLOGIA"              "BOP_NUM"                 
##  [7] "ANY"                      "MES"                     
##  [9] "DIA"                      "HORA_INI"                
## [11] "HORA_FIN"                 "DATA_INI"                
## [13] "DATA_FIN"                 "DURADA"                  
## [15] "FASE"                     "ENQUESTADOR_CODI"        
## [17] "ENQUESTADOR_SEXE"         "ENQUESTADOR_EDAT"        
## [19] "ENQUESTADOR_ESTUDIS"      "ENQUESTADOR_NACIONALITAT"
## [21] "NUM_QUEST_CAMP"           "PROVINCIA"               
## [23] "HABITAT"                  "MUNICIPI"                
## [25] "COMARCA"                  "CLUSTER_21"              
## [27] "ID_RUTA"                  "SECCIO_TEORICA"          
## [29] "CONF_SECC"                "SECCIO_REAL"             
## [31] "DOMICILI_PARTICULAR"      "LLENGUA_ENQUESTA"        
## [33] "PADRO"                    "RESIDENCIA"              
## [35] "LLENGUA_SISTEMA"          "CIUTADANIA"              
## [37] "GENERE"                   "GENERE_LITERALS"         
## [39] "SEXE"                     "EDAT"                    
## [41] "EDAT_GR"                  "EDAT_CEO"                
## [43] "LLOC_NAIX"                "HORA_PRIMERA_PREGUNTA"   
## [45] "GRAVACIO"                 "TIPUS_GRAV"              
## [47] "PRE_PROBLEMES"            "PROBLEMES_LITERALS"      
## [49] "PROBLEMES_R_1"            "PROBLEMES_R_2"

But default CEOdata() transforms the gathered data into pure-R format (labelled SPSS variables are converted into factors). If you want to use haven_labelled variables as provided by the raw SPSS files available, you can use the argument raw = TRUE.

d.raw <- CEOdata(raw = FALSE)

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")
## Converting the original data into R. This may take a while.
d746
## # A tibble: 2,000 × 475
##      NUM NUM_CINE BOP_NUM    MES   ANY   DIA CODI_ENQ HOR_INI HOR_FIN DURADA
##    <dbl>    <dbl> <fct>    <dbl> <dbl> <dbl> <fct>    <time>  <time>   <dbl>
##  1    NA        1 Març. 14     4    14    NA G3          NA      NA     1203
##  2    NA        2 Març. 14     4    14    NA T4          NA      NA      997
##  3    NA        3 Març. 14     4    14    NA G3          NA      NA     1127
##  4    NA        4 Març. 14     4    14    NA B5          NA      NA     1792
##  5    NA        5 Març. 14     4    14    NA B6          NA      NA     1418
##  6    NA        6 Març. 14     3    14    NA L1          NA      NA     1964
##  7    NA        7 Març. 14     4    14    NA G4          NA      NA     2283
##  8    NA        8 Març. 14     4    14    NA B3          NA      NA     1322
##  9    NA        9 Març. 14     3    14    NA B2          NA      NA     1778
## 10    NA       10 Març. 14     3    14    NA T4          NA      NA     1119
## # ℹ 1,990 more rows
## # ℹ 465 more variables: num_quest <dbl>, sexe_enq <fct>, edat_enq <dbl>,
## #   estudis_enq <fct>, nacionalitat_enq <fct>, PROVI <fct>, HABITAT <fct>,
## #   MUN <fct>, ADRECA <chr>, COMARCA <fct>, SEXE <fct>, EDAT <dbl>, SE <chr>,
## #   GR_EDAT <fct>, Edat_CEO <fct>, F01 <fct>, F02 <fct>, F03 <fct>, F04 <fct>,
## #   PRE_P1 <fct>, P1_LITERALS <chr>, P1_100_R <dbl>, P1_200_R <dbl>,
## #   P1_300_R <dbl>, P1_400_R <dbl>, P1_500_R <dbl>, P1_600_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 × 1,422
##    PONDERA ORDRE ORDRE_REVISADA   REO METODOLOGIA BOP_NUM        ANY   MES   DIA
##      <dbl> <dbl>          <dbl> <dbl> <fct>       <fct>        <dbl> <dbl> <dbl>
##  1       1 23339             NA   919 Presencial  Març 19 -919  2019     3     4
##  2       1 23340             NA   919 Presencial  Març 19 -919  2019     3     4
##  3       1 23341             NA   919 Presencial  Març 19 -919  2019     3     4
##  4       1 23342             NA   919 Presencial  Març 19 -919  2019     3     4
##  5       1 23343             NA   919 Presencial  Març 19 -919  2019     3     4
##  6       1 23344             NA   919 Presencial  Març 19 -919  2019     3     4
##  7       1 23345             NA   919 Presencial  Març 19 -919  2019     3     4
##  8       1 23346             NA   919 Presencial  Març 19 -919  2019     3     4
##  9       1 23347             NA   919 Presencial  Març 19 -919  2019     3     4
## 10       1 23348             NA   919 Presencial  Març 19 -919  2019     3     4
## # ℹ 4,490 more rows
## # ℹ 1,413 more variables: HORA_INI <time>, HORA_FIN <time>, DATA_INI <date>,
## #   DATA_FIN <date>, DURADA <dbl>, FASE <fct>, ENQUESTADOR_CODI <dbl>,
## #   ENQUESTADOR_SEXE <fct>, ENQUESTADOR_EDAT <dbl>, ENQUESTADOR_ESTUDIS <fct>,
## #   ENQUESTADOR_NACIONALITAT <fct>, NUM_QUEST_CAMP <dbl>, PROVINCIA <fct>,
## #   HABITAT <fct>, MUNICIPI <fct>, COMARCA <fct>, CLUSTER_21 <dbl>,
## #   ID_RUTA <dbl>, SECCIO_TEORICA <dbl>, CONF_SECC <fct>, SECCIO_REAL <dbl>, …

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] "CIRCUIT_1112_1" "CIRCUIT_1112_2" "CIRCUIT_1112_3" "CIRCUIT_1112_4"
## [5] "CIRCUIT_1112_5" "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,258 × 28
##    REO   `Titol enquesta`                  `Titol estudi` `Metodologia enquesta`
##    <fct> <chr>                             <chr>          <fct>                 
##  1 1070  Enquesta sobre generacions i par… Enquesta sobr… quantitativa          
##  2 1069  Enquesta d'inserció laboral dels… Enquesta d'in… quantitativa          
##  3 1068  Enquesta d'inserció laboral dels… Enquesta d'in… quantitativa          
##  4 1067  Enquesta d'inserció laboral dels… Enquesta d'in… quantitativa          
##  5 1066  Òmnibus de la Generalitat de Cat… Òmnibus de la… quantitativa          
##  6 1065  Òmnibus de la Generalitat de Cat… Òmnibus de la… quantitativa          
##  7 1064  Enquesta anual sobre els hàbits … Enquesta anua… quantitativa          
##  8 1063  Baròmetre de la bicicleta 2022    Baròmetre de … quantitativa          
##  9 1062  Enquesta de satisfacció dels ser… Enquesta de s… quantitativa          
## 10 1061  Baròmetre d'Opinió Política (BOP… Baròmetre d'O… quantitativa          
## # ℹ 1,248 more rows
## # ℹ 24 more variables: `Metode de recollida de dades` <fct>, 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>, …

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 enquesta`
##   <fct> <chr>                              <chr>          <fct>                 
## 1 746   Baròmetre d'Opinió Política (BOP)… Baròmetre d'O… quantitativa          
## # ℹ 24 more variables: `Metode de recollida de dades` <fct>, 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>, …

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: 47 × 28
##    REO   `Titol enquesta`                  `Titol estudi` `Metodologia enquesta`
##    <fct> <chr>                             <chr>          <fct>                 
##  1 1017  Seguiment d'indicadors de percep… Seguiment d'i… quantitativa          
##  2 1010  Enquesta metodològica i d'actitu… Enquesta meto… quantitativa          
##  3 1006  Seguiment d'indicadors de sosten… Seguiment d'i… quantitativa          
##  4 973   Seguiment d'indicadors de sosten… Seguiment d'i… quantitativa          
##  5 941   Seguiment d'indicadors de sosten… Seguiment d'i… quantitativa          
##  6 876   Baròmetre de la bicicleta 2017    Baròmetre de … quantitativa          
##  7 875   Seguiment d'indicadors de sosten… Seguiment d'i… quantitativa          
##  8 865   Seguiment d'indicadors de percep… Seguiment d'i… quantitativa          
##  9 819   Baròmetre 2015 de percepció i co… Baròmetre 201… quantitativa          
## 10 807   Seguiment d'Indicadors de Sosten… Seguiment d'i… quantitativa          
## # ℹ 37 more rows
## # ℹ 24 more variables: `Metode de recollida de dades` <fct>, 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>, …

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: 52 × 28
##    REO   `Titol enquesta`                  `Titol estudi` `Metodologia enquesta`
##    <fct> <chr>                             <chr>          <fct>                 
##  1 1017  Seguiment d'indicadors de percep… Seguiment d'i… quantitativa          
##  2 1010  Enquesta metodològica i d'actitu… Enquesta meto… quantitativa          
##  3 1006  Seguiment d'indicadors de sosten… Seguiment d'i… quantitativa          
##  4 973   Seguiment d'indicadors de sosten… Seguiment d'i… quantitativa          
##  5 941   Seguiment d'indicadors de sosten… Seguiment d'i… quantitativa          
##  6 876   Baròmetre de la bicicleta 2017    Baròmetre de … quantitativa          
##  7 875   Seguiment d'indicadors de sosten… Seguiment d'i… quantitativa          
##  8 865   Seguiment d'indicadors de percep… Seguiment d'i… quantitativa          
##  9 819   Baròmetre 2015 de percepció i co… Baròmetre 201… quantitativa          
## 10 807   Seguiment d'Indicadors de Sosten… Seguiment d'i… quantitativa          
## # ℹ 42 more rows
## # ℹ 24 more variables: `Metode de recollida de dades` <fct>, 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>, …

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: 70 × 28
##    REO   `Titol enquesta`                  `Titol estudi` `Metodologia enquesta`
##    <fct> <chr>                             <chr>          <fct>                 
##  1 1062  Enquesta de satisfacció dels ser… Enquesta de s… quantitativa          
##  2 1059  Enquesta ICIP 2022: Convivència … Enquesta ICIP… quantitativa          
##  3 1058  Enquesta de satisfacció dels ser… Enquesta de s… quantitativa          
##  4 1056  Estudi de percepció, experiència… Estudi de per… quantitativa          
##  5 1055  Estudi de percepció, experiència… Estudi de per… quantitativa          
##  6 1054  Estudi de percepció, experiència… Estudi de per… quantitativa          
##  7 1106  Enquesta sobre el grau de satisf… Enquesta sobr… quantitativa          
##  8 1053  Estudi de percepció, experiència… Estudi de per… quantitativa          
##  9 1052  Estudi de percepció, experiència… Estudi de per… quantitativa          
## 10 1049  Enquesta sobre les prioritats en… Enquesta sobr… quantitativa          
## # ℹ 60 more rows
## # ℹ 24 more variables: `Metode de recollida de dades` <fct>, 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>, …

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

CEOmeta() |>
  filter(`Mostra estudis quantitatius` < 500)
## # A tibble: 173 × 28
##    REO   `Titol enquesta`                  `Titol estudi` `Metodologia enquesta`
##    <fct> <chr>                             <chr>          <fct>                 
##  1 1106  Enquesta sobre el grau de satisf… Enquesta sobr… quantitativa          
##  2 1105  Enquesta sobre el grau de satisf… Enquesta sobr… quantitativa          
##  3 990   IPLAENSA Opinió i satisfacció de… IPLAENSA Opin… quantitativa          
##  4 989   Enquesta de satisfacció de l'usu… Enquesta de s… quantitativa          
##  5 984   iPLAENSA Satisfacció dels assegu… iPLAENSA Sati… quantitativa          
##  6 983   iPLAENSA: Satisfacció dels asseg… iPLAENSA: Sat… quantitativa          
##  7 1104  Enquesta sobre el grau de satisf… Enquesta sobr… quantitativa          
##  8 964   Enquesta satisfacció familiars r… Enquesta sati… quantitativa          
##  9 963   Enquesta satisfacció familiars c… Enquesta sati… quantitativa          
## 10 957   Avaluació del grau de satisfacci… Avaluació del… quantitativa          
## # ℹ 163 more rows
## # ℹ 24 more variables: `Metode de recollida de dades` <fct>, 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>, …

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 enquesta`
##    <fct> <chr>                             <chr>          <fct>                 
##  1 954   Baròmetre d'Opinió Política. 3a … Baròmetre d'O… quantitativa          
##  2 953   Enquesta de satisfacció dels ser… Enquesta de s… quantitativa          
##  3 952   Percepció sobre el debat territo… Percepció sob… quantitativa          
##  4 951   Cosmopolitisme i localisme a Cat… Cosmopolitism… quantitativa          
##  5 950   Enquesta de satisfacció hospital… Enquesta de s… quantitativa          
##  6 949   Enquesta sobre civisme i valors … Enquesta sobr… quantitativa          
##  7 948   Enquesta sobre el debat de polít… Enquesta sobr… quantitativa          
##  8 947   Baròmetre sanitari de Catalunya.… Baròmetre san… quantitativa          
##  9 946   Òmnibus de la Generalitat de Cat… Òmnibus de la… quantitativa          
## 10 945   Baròmetre de satisfacció dels tu… Baròmetre de … quantitativa          
## # ℹ 35 more rows
## # ℹ 24 more variables: `Metode de recollida de dades` <fct>, 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>, …

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: 1,422 × 2
##    Variable       Label                                                      
##    <chr>          <chr>                                                      
##  1 PONDERA        Coeficients de ponderació                                  
##  2 ORDRE          Número d'ordre                                             
##  3 ORDRE_REVISADA Número d'ordre de registre original (variable anonimitzada)
##  4 REO            Número de registre                                         
##  5 METODOLOGIA    Metodologia d'enquestació                                  
##  6 BOP_NUM        Número d'ordre del baròmetre                               
##  7 ANY            Any de realització del baròmetre                           
##  8 MES            Mes de realització del baròmetre                           
##  9 DIA            Dia                                                        
## 10 HORA_INI       Hora d'inici de l'entrevista (variable anonimitzada)       
## # ℹ 1,412 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: 20,443 × 2
##    Variable    Value        
##    <fct>       <fct>        
##  1 METODOLOGIA Presencial   
##  2 METODOLOGIA Telefònica   
##  3 METODOLOGIA En línia     
##  4 BOP_NUM     Març 14 - 746
##  5 BOP_NUM     Oct. 14 -758 
##  6 BOP_NUM     Feb 15 -774  
##  7 BOP_NUM     Juny 15 -795 
##  8 BOP_NUM     Oct. 15 -804 
##  9 BOP_NUM     Feb 16 -816  
## 10 BOP_NUM     Juny 16 -826 
## # ℹ 20,433 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: 22 × 2
##    Variable                        Label                                        
##    <chr>                           <chr>                                        
##  1 ENQUESTADOR_EDAT                Edat de entrevistador/a                      
##  2 EDAT                            Edat                                         
##  3 EDAT_GR                         Grups d'edat                                 
##  4 EDAT_CEO                        Grups d'edat reagrupada (recodificació grups…
##  5 INF_POL_OBJ_RANG_ESCOLARITZACIO De quina edat a quina edat és obligatori l’e…
##  6 INF_POL_OBJ_INI_ESCOLARITZACIO  De quina edat a quina edat és obligatori l’e…
##  7 INF_POL_OBJ_FI_ESCOLARITZACIO   De quina edat a quina edat és obligatori l’e…
##  8 POSICIO_BARCA_LLIGA             En quina posició han quedat els següents equ…
##  9 POSICIO_BARCA_LLIGA_RESPOSTA    En quina posició han quedat els següents equ…
## 10 POSICIO_GIRONA_LLIGA            En quina posició han quedat els següents equ…
## # ℹ 12 more rows

Finally, an English translation of the variable labels/values is provided if the argument translate is set to TRUE, by opening a browser tab with the translations.

CEOsearch(d, keyword = "edat", translate = TRUE)
## Looking for entries with: edat
## # A tibble: 22 × 2
##    Variable                        Label                                        
##    <chr>                           <chr>                                        
##  1 ENQUESTADOR_EDAT                Edat de entrevistador/a                      
##  2 EDAT                            Edat                                         
##  3 EDAT_GR                         Grups d'edat                                 
##  4 EDAT_CEO                        Grups d'edat reagrupada (recodificació grups…
##  5 INF_POL_OBJ_RANG_ESCOLARITZACIO De quina edat a quina edat és obligatori l’e…
##  6 INF_POL_OBJ_INI_ESCOLARITZACIO  De quina edat a quina edat és obligatori l’e…
##  7 INF_POL_OBJ_FI_ESCOLARITZACIO   De quina edat a quina edat és obligatori l’e…
##  8 POSICIO_BARCA_LLIGA             En quina posició han quedat els següents equ…
##  9 POSICIO_BARCA_LLIGA_RESPOSTA    En quina posició han quedat els següents equ…
## 10 POSICIO_GIRONA_LLIGA            En quina posició han quedat els següents equ…
## # ℹ 12 more rows

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 with `by = join_by(Variable)`
## # A tibble: 20,586 × 3
##    Variable       Label                                                    Value
##    <chr>          <chr>                                                    <fct>
##  1 PONDERA        Coeficients de ponderació                                <NA> 
##  2 ORDRE          Número d'ordre                                           <NA> 
##  3 ORDRE_REVISADA Número d'ordre de registre original (variable anonimitz… <NA> 
##  4 REO            Número de registre                                       <NA> 
##  5 METODOLOGIA    Metodologia d'enquestació                                Pres…
##  6 METODOLOGIA    Metodologia d'enquestació                                Tele…
##  7 METODOLOGIA    Metodologia d'enquestació                                En l…
##  8 BOP_NUM        Número d'ordre del baròmetre                             Març…
##  9 BOP_NUM        Número d'ordre del baròmetre                             Oct.…
## 10 BOP_NUM        Número d'ordre del baròmetre                             Feb …
## # ℹ 20,576 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.