Skip to contents

Search for keywords on the time-series catalogs.

Usage

bde_catalog_search(pattern, ...)

Arguments

pattern

regex pattern to search See Details and Examples.

...

Arguments passed on to bde_catalog_load

catalog

A single value indicating the catalogs to be updated or "ALL" as a shorthand. See Details.

parse_dates

Logical. If TRUE the dates would be parsed using bde_parse_dates().

update_cache

Logical. If TRUE the requested file would be updated on the cache_dir.

cache_dir

A path to a cache directory. The directory can also be set via options with options(bde_cache_dir = "path/to/dir").

verbose

Logical TRUE or FALSE, display information useful for debugging.

Value

A tibble object with the results of the query.

Details

Note that BdE files are only provided in Spanish, for the time being. Therefore search terms should be provided in Spanish as well in order to get search results.

This function uses base::grep() function for finding matches on the catalogs. You can pass regular expressions to broaden the search.

Examples

# \donttest{
# Simple search (needs to be in Spanish)
# !! PIB [es] == GDP [en]

bde_catalog_search("PIB")
#> # A tibble: 389 × 17
#>    Nombre_de_la_serie Numero_secuencial Alias_de_la_serie Nombre_del_archivo_c…¹
#>    <chr>              <chr>             <chr>             <chr>                 
#>  1 DSPC102016WB11000… 2665111           BE_1_1.7          BE0101.csv            
#>  2 DSPC102016WB1QB00… 2665112           BE_1_1.8          BE0101.csv            
#>  3 DSPC102016PB1QB00… 2665115           BE_1_1.11         BE0101.csv            
#>  4 DTNSEC2010_S0000P… 2563971           BE_1_6.1          BE0106.csv            
#>  5 DTNSEC2010_S0000P… 2563952           BE_1_6.2          BE0106.csv            
#>  6 DTNSEC2010_S0000P… 2563953           BE_1_6.3          BE0106.csv            
#>  7 DTNSEC2010_S0000P… 2563954           BE_1_6.4          BE0106.csv            
#>  8 DTNSEC2010_S0000P… 2563955           BE_1_6.5          BE0106.csv            
#>  9 DTNSEC2010_S0000P… 2563956           BE_1_6.6          BE0106.csv            
#> 10 DTNSEC2010_S0000P… 2563957           BE_1_6.7          BE0106.csv            
#> # ℹ 379 more rows
#> # ℹ abbreviated name: ¹​Nombre_del_archivo_con_los_valores_de_la_serie
#> # ℹ 13 more variables: Descripcion_de_la_serie <chr>, Tipo_de_variable <chr>,
#> #   Codigo_de_unidades <chr>, Exponente <dbl>, Numero_de_decimales <dbl>,
#> #   Descripcion_de_unidades_y_exponente <chr>, Frecuencia_de_la_serie <chr>,
#> #   Fecha_de_la_primera_observacion <date>,
#> #   Fecha_de_la_ultima_observacion <date>, Numero_de_observaciones <dbl>, …

# More complex - Single
bde_catalog_search("Francia(.*)PIB")
#> # A tibble: 5 × 17
#>   Nombre_de_la_serie  Numero_secuencial Alias_de_la_serie Nombre_del_archivo_c…¹
#>   <chr>               <chr>             <chr>             <chr>                 
#> 1 DTNSEC2010_S0000P_… 2563958           BE_1_6.8          BE0106.csv            
#> 2 DTNPDE2010_P0000P_… 2563918           BE_1_7.8          BE0107.csv            
#> 3 D_UNFKA003          143057            BE_26_1.6         BE2601.csv            
#> 4 D_UNFKB003          143072            BE_26_2.6         BE2602.csv            
#> 5 DPUUNFKB103         906092            SI_2_1.50         SI_2_1.csv            
#> # ℹ abbreviated name: ¹​Nombre_del_archivo_con_los_valores_de_la_serie
#> # ℹ 13 more variables: Descripcion_de_la_serie <chr>, Tipo_de_variable <chr>,
#> #   Codigo_de_unidades <chr>, Exponente <dbl>, Numero_de_decimales <dbl>,
#> #   Descripcion_de_unidades_y_exponente <chr>, Frecuencia_de_la_serie <chr>,
#> #   Fecha_de_la_primera_observacion <date>,
#> #   Fecha_de_la_ultima_observacion <date>, Numero_de_observaciones <dbl>,
#> #   Titulo_de_la_serie <chr>, Fuente <chr>, Notas <chr>

# Even more complex - Double
bde_catalog_search("Francia(.*)PIB|Italia(.*)PIB|Alemania(.*)PIB")
#> # A tibble: 15 × 17
#>    Nombre_de_la_serie Numero_secuencial Alias_de_la_serie Nombre_del_archivo_c…¹
#>    <chr>              <chr>             <chr>             <chr>                 
#>  1 DTNSEC2010_S0000P… 2563953           BE_1_6.3          BE0106.csv            
#>  2 DTNSEC2010_S0000P… 2563958           BE_1_6.8          BE0106.csv            
#>  3 DTNSEC2010_S0000P… 2563959           BE_1_6.10         BE0106.csv            
#>  4 DTNPDE2010_P0000P… 2563913           BE_1_7.3          BE0107.csv            
#>  5 DTNPDE2010_P0000P… 2563918           BE_1_7.8          BE0107.csv            
#>  6 DTNPDE2010_P0000P… 2563919           BE_1_7.10         BE0107.csv            
#>  7 D_UNFKA0T8         304076            BE_26_1.5         BE2601.csv            
#>  8 D_UNFKA003         143057            BE_26_1.6         BE2601.csv            
#>  9 D_UNFKA009         143060            BE_26_1.8         BE2601.csv            
#> 10 D_UNFKB0T8         304083            BE_26_2.5         BE2602.csv            
#> 11 D_UNFKB003         143072            BE_26_2.6         BE2602.csv            
#> 12 D_UNFKB009         143075            BE_26_2.8         BE2602.csv            
#> 13 DPUUNFKB1T8        906091            SI_2_1.48         SI_2_1.csv            
#> 14 DPUUNFKB103        906092            SI_2_1.50         SI_2_1.csv            
#> 15 DPUUNFKB109        906093            SI_2_1.52         SI_2_1.csv            
#> # ℹ abbreviated name: ¹​Nombre_del_archivo_con_los_valores_de_la_serie
#> # ℹ 13 more variables: Descripcion_de_la_serie <chr>, Tipo_de_variable <chr>,
#> #   Codigo_de_unidades <chr>, Exponente <dbl>, Numero_de_decimales <dbl>,
#> #   Descripcion_de_unidades_y_exponente <chr>, Frecuencia_de_la_serie <chr>,
#> #   Fecha_de_la_primera_observacion <date>,
#> #   Fecha_de_la_ultima_observacion <date>, Numero_de_observaciones <dbl>,
#> #   Titulo_de_la_serie <chr>, Fuente <chr>, Notas <chr>


# Search a sequential code: Exact match
# Note that this series (sequential code) appears on several tables

bde_catalog_search("^3779313$")
#> # A tibble: 2 × 17
#>   Nombre_de_la_serie  Numero_secuencial Alias_de_la_serie Nombre_del_archivo_c…¹
#>   <chr>               <chr>             <chr>             <chr>                 
#> 1 DSPC102016VB1QB00_… 3779313           BE_2_1.19         BE0201.csv            
#> 2 DSPC102016VB1QB00_… 3779313           SI_2_1.54         SI_2_1.csv            
#> # ℹ abbreviated name: ¹​Nombre_del_archivo_con_los_valores_de_la_serie
#> # ℹ 13 more variables: Descripcion_de_la_serie <chr>, Tipo_de_variable <chr>,
#> #   Codigo_de_unidades <chr>, Exponente <dbl>, Numero_de_decimales <dbl>,
#> #   Descripcion_de_unidades_y_exponente <chr>, Frecuencia_de_la_serie <chr>,
#> #   Fecha_de_la_primera_observacion <date>,
#> #   Fecha_de_la_ultima_observacion <date>, Numero_de_observaciones <dbl>,
#> #   Titulo_de_la_serie <chr>, Fuente <chr>, Notas <chr>
# }