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: 85 × 17
#>    Nombre_de_la_serie Numero_secuencial Alias_de_la_serie Nombre_del_archivo_c…¹
#>    <chr>              <chr>             <chr>             <chr>                 
#>  1 DSPC102020CB90000… 4664041           BE_2_2.22         BE0202.csv            
#>  2 DANPDE2010_PIBPM   2418466           BE_2_9.3          BE0209.csv            
#>  3 DTNSEC2010_PIBPM   2325811           BE_11_1.12        BE1101.csv            
#>  4 DTNSEC2010_PIBPM   2325811           BE_11_2.12        BE1102.csv            
#>  5 DTNSEC2010_PIBPM.T 2325812           BE_11_3.12        BE1103.csv            
#>  6 DTNSEC2010_PIBPM   2325811           BE_11_5.16        BE1105.csv            
#>  7 DTNSEC2010_PIBPM   2325811           BE_11_15.11       BE1115.csv            
#>  8 DTNSEC2010_PIBPM   2325811           BE_12_1.10        BE1201.csv            
#>  9 DTNSEC2010_PIBPM   2325811           BE_12_2.11        BE1202.csv            
#> 10 DTNPDE2010_F9000P… 2327319           BE_12_8.11        BE1208.csv            
#> # ℹ 75 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: 2 × 17
#>   Nombre_de_la_serie Numero_secuencial Alias_de_la_serie Nombre_del_archivo_co…¹
#>   <chr>              <chr>             <chr>             <chr>                  
#> 1 D_UNFKA003         143057            BE_26_1.6         BE2601.csv             
#> 2 D_UNFKB003         143072            BE_26_2.6         BE2602.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: 6 × 17
#>   Nombre_de_la_serie Numero_secuencial Alias_de_la_serie Nombre_del_archivo_co…¹
#>   <chr>              <chr>             <chr>             <chr>                  
#> 1 D_UNFKA0T8         304076            BE_26_1.5         BE2601.csv             
#> 2 D_UNFKA003         143057            BE_26_1.6         BE2601.csv             
#> 3 D_UNFKA009         143060            BE_26_1.8         BE2601.csv             
#> 4 D_UNFKB0T8         304083            BE_26_2.5         BE2602.csv             
#> 5 D_UNFKB003         143072            BE_26_2.6         BE2602.csv             
#> 6 D_UNFKB009         143075            BE_26_2.8         BE2602.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>
# }