| Title: | Retrieve Time Series Data from 'Banco de España' |
|---|---|
| Description: | Tools for retrieving 'Banco de España' ('BdE') time series data as 'tibble' objects from bulk CSV files and the 'Statistics web service (API)'. Bulk CSV helpers use stable 'BdE' sequential numbers, and API helpers use API series codes. 'Banco de España' is the national central bank and, within the framework of the Single Supervisory Mechanism ('SSM'), the supervisor of the Spanish banking system alongside the European Central Bank. This package is not sponsored, endorsed or administered by 'Banco de España'. |
| Authors: | Diego H. Herrero [aut, cre, cph] (ORCID: <https://orcid.org/0000-0001-8457-4658>), Banco de España [cph] (ROR: <https://ror.org/02f26yq04>, Data copyright holder) |
| Maintainer: | Diego H. Herrero <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 0.6.1.9000 |
| Built: | 2026-06-22 09:20:47 UTC |
| Source: | https://github.com/rOpenSpain/tidyBdE |
These functions manage BdE time series catalog metadata from the bulk CSV files published by Banco de España.
bde_catalog_load() loads time series catalog metadata into a tibble,
bde_catalog_update() refreshes the cached catalog files and
bde_catalog_search() searches catalog metadata for keywords.
bde_catalog_load( catalog = c("ALL", "BE", "SI", "TC", "TI", "PB"), parse_dates = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE ) bde_catalog_update( catalog = c("ALL", "BE", "SI", "TC", "TI", "PB"), cache_dir = NULL, verbose = FALSE ) bde_catalog_search(pattern, ...)bde_catalog_load( catalog = c("ALL", "BE", "SI", "TC", "TI", "PB"), parse_dates = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE ) bde_catalog_update( catalog = c("ALL", "BE", "SI", "TC", "TI", "PB"), cache_dir = NULL, verbose = FALSE ) bde_catalog_search(pattern, ...)
catalog |
A single catalog identifier or |
parse_dates |
Logical. If |
cache_dir |
Path to a cache directory. The directory can also be set
with |
update_cache |
Logical. If |
verbose |
Logical. If |
pattern |
Regular expression to search for. See Details and Examples. |
... |
Additional arguments passed by |
Accepted values for catalog are:
| CODE | PUBLICATION | UPDATE FREQUENCY | FREQUENCY |
"BE" |
Statistical Bulletin | Daily | Monthly |
"SI" |
Summary Indicators | Daily | Daily |
"TC" |
Exchange Rates | Daily | Daily |
"TI" |
Interest Rates | Daily | Daily |
"PB" |
Bank Lending Survey | Quarterly | Quarterly |
Use "ALL" as a shorthand for loading or updating all catalogs at once.
If the requested catalog is not cached, bde_catalog_load() calls
bde_catalog_update().
Note: BdE catalog metadata is currently available in Spanish only.
Therefore, search terms passed to bde_catalog_search() must be in Spanish
to retrieve results.
bde_catalog_search() uses base::grep() to find matches in the catalog
metadata. You can pass regular expressions to broaden the
search.
bde_catalog_load() returns a tibble with the requested
time series catalog metadata. See
vignette("csv_manual", package = "tidyBdE") for details.
bde_catalog_update() returns an invisible list of download results.
bde_catalog_search() returns a tibble with matching
catalog rows.
Time series bulk data download.
bde_series_load() and bde_series_full_load() for loading bulk
CSV series and bde_series_api_load() and bde_series_api_latest() for
retrieving series through the Statistics web service.
bde_catalog_load("TI", verbose = TRUE) # Simple search. Search terms must be in Spanish. # PIB [es] == GDP [en]. bde_catalog_search("PIB") # Search with a single complex condition. bde_catalog_search("Francia(.*)PIB") # Search with multiple complex conditions. bde_catalog_search("Francia(.*)PIB|Italia(.*)PIB|Alemania(.*)PIB") bde_catalog_update("TI", verbose = TRUE)bde_catalog_load("TI", verbose = TRUE) # Simple search. Search terms must be in Spanish. # PIB [es] == GDP [en]. bde_catalog_search("PIB") # Search with a single complex condition. bde_catalog_search("Francia(.*)PIB") # Search with multiple complex conditions. bde_catalog_search("Francia(.*)PIB|Italia(.*)PIB|Alemania(.*)PIB") bde_catalog_update("TI", verbose = TRUE)
Minimal metadata for the selected Spanish macroeconomic indicators available
through the convenience functions in tidyBdE. See
bde_indicators().
Full catalog metadata is available with bde_catalog_load().
A tibble of 9 rows and 8 columns with the following fields:
Function name. See bde_indicators().
Sequential number. See bde_series_load().
API series code. See bde_series_api()
Description of the series in Spanish.
Starting date of the indicator.
Most recent date available.
Data source.
| tidyBdE_fun | Numero_secuencial | Nombre_de_la_serie | Descripcion_de_la_serie | Frecuencia_de_la_serie | Fecha_de_la_primera_observacion | Fecha_de_la_ultima_observacion | Fuente |
| bde_ind_cpi_var | 1489713 | DPU1NEAC920 | Estadísticas Generales. IPCA. Base 2015. Índice general. Tasa interanual. España | MENSUAL | 1997-01-01 | 2026-05-01 | Eurostat |
| bde_ind_euribor_12m_daily | 905842 | DPUDNBAF172 | Tipo de interés. UEM. Mercado monetario. Euríbor. A 12 meses | LABORABLE | 2000-01-03 | 2026-06-18 | REFINITIV |
| bde_ind_euribor_12m_monthly | 587853 | D_1NBAF472 | Tipo de interés. UEM. Mercado monetario. Euríbor. A 12 meses | MENSUAL | 1999-01-01 | 2026-05-01 | The European Money Market Institute (EMMI) |
| bde_ind_gdp_quarterly | 4663160 | DSPC102020CB1QB00_SS1_TSC.T | Estadísticas Generales. Cuentas Nacionales. SEC2010. Año base 2020. Precios corrientes. Producto interior bruto. Economía en su conjunto (Total de la economía) (Saldo). Datos corregidos de efectos estacionales y de calendario. TRIMESTRAL | TRIMESTRAL | 1995-03-01 | 2026-03-01 | Instituto Nacional de Estadistica |
| bde_ind_gdp_var | 4663788 | DSPC102020VB1QB00_SS1_TSCTVA.T | Estadísticas Generales. CNTR. Base 2020. PIB. Precios constantes. Datos CVEC. Tasa interanual. España | TRIMESTRAL | 1996-03-01 | 2026-03-01 | Eurostat |
| bde_ind_ibex_daily | 821340 | DBLEESI100000000IBDI.B | Cotización y contratación. Acciones. Sociedad de Bolsas y Sociedad Rectora de la Bolsa de Madrid. Índice cotización. Indice IBEX 35 | LABORABLE | 1999-01-04 | 2026-06-18 | Bolsa de Madrid y Comisión Nacional del Mercado de Valores |
| bde_ind_ibex_monthly | 254433 | D_1TGC000A | Cotización y contratación. Acciones. Sociedad de Bolsas y Sociedad Rectora de la Bolsa de Madrid. Índice cotización. Indice IBEX 35 | MENSUAL | 1987-01-01 | 2026-04-01 | SOCIEDAD RECTORA DE LA BOLSA DE MADRID |
| bde_ind_population | 4637737 | DEPA202110.T | Estadísticas generales. INE. EPA. Base 2021. Total Nacional. Ambos sexos. Todas las edades. Personas. Trimestral | TRIMESTRAL | 2002-03-01 | 2025-12-01 | Instituto Nacional de Estadística |
| bde_ind_unemployment_rate | 4635980 | DEPA202140_TSPA.T | Estadísticas Generales. EPA. Base 2021. Total Nacional. Tasa de paro de la población. Ambos sexos. 16 y más años | TRIMESTRAL | 2002-03-01 | 2026-03-01 | Instituto Nacional de Estadística |
vignette("csv_manual", package = "tidyBdE").
Selected indicators and metadata:
bde_indicators
data("bde_ind_db") bde_ind_dbdata("bde_ind_db") bde_ind_db
Retrieve selected Spanish macroeconomic indicators. Metadata is available in bde_ind_db.
bde_ind_gdp_var(series_label = "GDP_YoY", ...) bde_ind_unemployment_rate(series_label = "Unemployment_Rate", ...) bde_ind_euribor_12m_monthly(series_label = "Euribor_12M_Monthly", ...) bde_ind_euribor_12m_daily(series_label = "Euribor_12M_Daily", ...) bde_ind_cpi_var(series_label = "Consumer_price_index_YoY", ...) bde_ind_ibex_monthly(series_label = "IBEX_index_month", ...) bde_ind_ibex_daily(series_label = "IBEX_index_day", ...) bde_ind_gdp_quarterly(series_label = "GDP_quarterly_value", ...) bde_ind_population(series_label = "Population_Spain", ...)bde_ind_gdp_var(series_label = "GDP_YoY", ...) bde_ind_unemployment_rate(series_label = "Unemployment_Rate", ...) bde_ind_euribor_12m_monthly(series_label = "Euribor_12M_Monthly", ...) bde_ind_euribor_12m_daily(series_label = "Euribor_12M_Daily", ...) bde_ind_cpi_var(series_label = "Consumer_price_index_YoY", ...) bde_ind_ibex_monthly(series_label = "IBEX_index_month", ...) bde_ind_ibex_daily(series_label = "IBEX_index_day", ...) bde_ind_gdp_quarterly(series_label = "GDP_quarterly_value", ...) bde_ind_population(series_label = "Population_Spain", ...)
series_label |
Optional character string or vector of labels to assign to the extracted series. |
... |
Arguments passed on to
|
These functions are convenient wrappers for bde_series_load() that
retrieve specific series. Use verbose = TRUE, extract_metadata = TRUE to
inspect the metadata and source.
A tibble with the requested indicator series.
These functions attempt to parse columns as double values. For some time
series, a warning may be displayed if parsing fails. Set
parse_numeric = FALSE to disable numeric parsing.
Time series bulk data download.
bde_series_load() for loading arbitrary bulk CSV series and
bde_catalog_search() for finding series in catalog metadata.
Selected indicators and metadata:
bde_ind_db
bde_ind_gdp_var()bde_ind_gdp_var()
Parse strings representing dates with as.Date(). This function is tailored
to date formats used in this package and may not parse other datasets. See
Examples for supported formats.
| FREQUENCY | FORMAT | EXAMPLES |
| Daily / Business day | DD MMMMYYYY |
02 FEB2019 |
| Monthly | MMM YYYY |
MAR 2020 |
| Quarterly | MMM YYYY, where MMM is the first or last month of the quarter, depending on the value of the OBSERVED variable. |
For the first quarter of 2020: ENE 2020, MAR 2020 |
| Half-yearly | MMM YYYY, where MMM is the first or last month of the half-year period, depending on the value of its OBSERVED variable. |
For the first half of 2020: ENE 2020, JUN 2020 |
| Annual | YYYY |
2020
|
See vignette("csv_manual", package = "tidyBdE") for details.
bde_parse_dates(dates_to_parse)bde_parse_dates(dates_to_parse)
dates_to_parse |
Character vector of date strings to parse. |
A vector of Date values.
as.Date() for base R date conversion.
# Supported formats. would_parse <- c( "02 FEB2019", "15 ABR 1890", "MAR 2020", "ENE2020", "2020", "12-1993", "01-02-2014", "01/02/1990" ) parsed_ok <- bde_parse_dates(would_parse) class(parsed_ok) tibble::tibble(raw = would_parse, parsed = parsed_ok) # Unsupported formats. wont_parse <- c("JAN2001", "2010-01-12", "01 APR 2017", "01/31/1990") parsed_fail <- bde_parse_dates(wont_parse) class(parsed_fail) tibble::tibble(raw = wont_parse, parsed = parsed_fail)# Supported formats. would_parse <- c( "02 FEB2019", "15 ABR 1890", "MAR 2020", "ENE2020", "2020", "12-1993", "01-02-2014", "01/02/1990" ) parsed_ok <- bde_parse_dates(would_parse) class(parsed_ok) tibble::tibble(raw = would_parse, parsed = parsed_ok) # Unsupported formats. wont_parse <- c("JAN2001", "2010-01-12", "01 APR 2017", "01/31/1990") parsed_fail <- bde_parse_dates(wont_parse) class(parsed_fail) tibble::tibble(raw = wont_parse, parsed = parsed_fail)
These functions load BdE time series from the bulk CSV files published by Banco de España.
bde_series_load() extracts one or more series by their stable sequential
number. bde_series_full_load() loads a complete bulk CSV file and returns
all series included in that file.
See vignette("csv_manual", package = "tidyBdE") for details.
bde_series_load( series_code, series_label = NULL, out_format = "wide", parse_dates = TRUE, parse_numeric = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE, extract_metadata = FALSE ) bde_series_full_load( series_csv, parse_dates = TRUE, parse_numeric = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE, extract_metadata = FALSE )bde_series_load( series_code, series_label = NULL, out_format = "wide", parse_dates = TRUE, parse_numeric = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE, extract_metadata = FALSE ) bde_series_full_load( series_csv, parse_dates = TRUE, parse_numeric = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE, extract_metadata = FALSE )
series_code |
Numeric vector of stable BdE sequential numbers, or
values coercible with |
series_label |
Optional character string or vector of labels to assign to the extracted series. |
out_format |
Output format, either |
parse_dates |
Logical. If |
parse_numeric |
Logical. If |
cache_dir |
Path to a cache directory. The directory can also be set
with |
update_cache |
Logical. If |
verbose |
Logical. If |
extract_metadata |
Logical. If |
series_csv |
Bulk CSV file name for a series, as defined in the field
|
bde_series_load() returns a tibble with a Date column:
With out_format = "wide", each series is presented in a separate column
with the name defined by series_label.
With out_format = "long", the tibble has two additional columns:
serie_name, with the label of each series and serie_value, with the
corresponding value.
"wide" format is more suitable for exporting to a CSV file, while
"long" format is more suitable for creating plots with
ggplot2::ggplot(). See also tidyr::pivot_longer() and
tidyr::pivot_wider().
bde_series_full_load() returns a tibble with a Date
column and the aliases of the time series columns as described in catalog
metadata. See bde_catalog_load() and
vignette("csv_manual", package = "tidyBdE") for details.
A series alias is a positional code that identifies the location, column or row of a series in a table. An alias is unique within its context but is not stable because it may change when a series moves.
A single time series may appear in different tables, so it can have several
aliases. Use bde_series_full_load() when you need to work with aliases or
load a complete file.
The series alias is also used in full CSV files. For example, table be_6_1 represents Table 1, Chapter 6 of the Statistical Bulletin ("BE"). Although it is unique, it is subject to change, for example when a new table is inserted before it.
BdE identifies each series with a stable sequential number
(Número secuencial) in bulk CSV files and an API series code
(Nombre_de_la_serie) in the Statistics web service.
bde_series_load() accepts stable sequential numbers in series_code.
bde_series_api_latest() and bde_series_api_load() use the same argument
for API series codes. Use bde_catalog_load() or bde_catalog_search() to
find both identifiers.
These functions attempt to parse columns as double values. For some time
series, a warning may be displayed if parsing fails. Set
parse_numeric = FALSE to disable numeric parsing.
Time series bulk data download.
bde_catalog_load() and bde_catalog_search() for finding stable
sequential numbers, and bde_indicators() for convenience wrappers.
Time series functions:
bde_series_api
# Show metadata. bde_series_load(573234, verbose = TRUE, extract_metadata = TRUE) # Load data. bde_series_load(573234, extract_metadata = FALSE) # Load multiple series. bde_series_load(c(573234, 573214), series_label = c("US/EUR", "GBP/EUR"), extract_metadata = TRUE ) wide <- bde_series_load(c(573234, 573214), series_label = c("US/EUR", "GBP/EUR") ) # Show wide output. wide # Show long output. long <- bde_series_load(c(573234, 573214), series_label = c("US/EUR", "GBP/EUR"), out_format = "long" ) long # Use with ggplot2. library(ggplot2) ggplot(long, aes(Date, serie_value)) + geom_line(aes(group = serie_name, color = serie_name)) + scale_color_bde_d() + theme_tidybde() # Show metadata for a complete bulk CSV file. bde_series_full_load("TI_1_1.csv", extract_metadata = TRUE) # Load a complete bulk CSV file. bde_series_full_load("TI_1_1.csv")# Show metadata. bde_series_load(573234, verbose = TRUE, extract_metadata = TRUE) # Load data. bde_series_load(573234, extract_metadata = FALSE) # Load multiple series. bde_series_load(c(573234, 573214), series_label = c("US/EUR", "GBP/EUR"), extract_metadata = TRUE ) wide <- bde_series_load(c(573234, 573214), series_label = c("US/EUR", "GBP/EUR") ) # Show wide output. wide # Show long output. long <- bde_series_load(c(573234, 573214), series_label = c("US/EUR", "GBP/EUR"), out_format = "long" ) long # Use with ggplot2. library(ggplot2) ggplot(long, aes(Date, serie_value)) + geom_line(aes(group = serie_name, color = serie_name)) + scale_color_bde_d() + theme_tidybde() # Show metadata for a complete bulk CSV file. bde_series_full_load("TI_1_1.csv", extract_metadata = TRUE) # Load a complete bulk CSV file. bde_series_full_load("TI_1_1.csv")
These functions retrieve BdE time series using the Statistics web service (API).
The API is a JSON web service that provides URL-based access to information available in the Statistics section of Banco de España and the BIEST application.
The API defines two request types. bde_series_api_latest() uses the Latest
Data request to obtain the latest published observation for one or more
series. bde_series_api_load() uses the Series List request to obtain the
details of one or more complete series and their metadata.
bde_series_api_latest(series_code, language = c("en", "es"), verbose = FALSE) bde_series_api_load( series_code, series_label = NULL, out_format = "wide", language = c("en", "es"), time_range = NULL, verbose = FALSE, extract_metadata = FALSE )bde_series_api_latest(series_code, language = c("en", "es"), verbose = FALSE) bde_series_api_load( series_code, series_label = NULL, out_format = "wide", language = c("en", "es"), time_range = NULL, verbose = FALSE, extract_metadata = FALSE )
series_code |
Character string or vector of API series codes
taken from the |
language |
Character string specifying the output language. Use |
verbose |
Logical. If |
series_label |
Optional character string or vector of labels to assign to the extracted series. |
out_format |
Output format, either |
time_range |
Optional character string specifying an annual range or API
range code. It can be a year, such as |
extract_metadata |
Logical. If |
Allowed time_range values depend on the series frequency:
Daily frequency (D): "3M" (last 3 months), "12M" and "36M".
Monthly frequency (M): "30M", "60M" and "MAX" (entire series).
Quarterly frequency (Q): "30M", "60M" and "MAX".
Annual frequency (A): "60M" and "MAX".
If time_range is not specified, the request returns the smallest range for
the series frequency. For example, monthly series return "30M".
bde_series_api_latest() returns a tibble with the latest
published observation for each valid series. It includes fields returned by
the Latest Data request such as serie, descripcionCorta, codFrecuencia,
decimales, simbolo, tendencia, fechaValor and valor.
bde_series_api_load() returns a tibble. When
extract_metadata = FALSE, API dates are parsed as Date
values and observations are returned in wide or long format according to
out_format. When extract_metadata = TRUE, it returns one row per valid
series with fields returned by the Series List request, including
fechaInicio, fechaFin and metadata fields derived from informacion.
BdE identifies each series with a stable sequential number
(Número secuencial) in bulk CSV files and an API series code
(Nombre_de_la_serie) in the Statistics web service.
bde_series_load() accepts stable sequential numbers in series_code.
bde_series_api_latest() and bde_series_api_load() use the same argument
for API series codes. Use bde_catalog_load() or bde_catalog_search() to
find both identifiers.
bde_catalog_load() and bde_catalog_search() for finding API
series codes, and bde_series_load() for loading bulk CSV series.
Time series functions:
bde_series
xr <- bde_catalog_load(catalog = "TC") # Extract the latest value. library(dplyr) xr |> slice_head(n = 3) |> pull(Nombre_de_la_serie) |> bde_series_api_latest(language = "en") |> glimpse() # Extract the latest months. xr |> slice_head(n = 1) |> pull(Nombre_de_la_serie) |> bde_series_api_load(language = "en", time_range = "12M") |> glimpse() # Extract metadata. xr |> slice_head(n = 1) |> pull(Nombre_de_la_serie) |> bde_series_api_load( language = "en", time_range = "12M", extract_metadata = TRUE ) |> glimpse()xr <- bde_catalog_load(catalog = "TC") # Extract the latest value. library(dplyr) xr |> slice_head(n = 3) |> pull(Nombre_de_la_serie) |> bde_series_api_latest(language = "en") |> glimpse() # Extract the latest months. xr |> slice_head(n = 1) |> pull(Nombre_de_la_serie) |> bde_series_api_load(language = "en", time_range = "12M") |> glimpse() # Extract metadata. xr |> slice_head(n = 1) |> pull(Nombre_de_la_serie) |> bde_series_api_load( language = "en", time_range = "12M", extract_metadata = TRUE ) |> glimpse()
Manually defined palettes based on BdE publications. Each palette contains at most six colors.
bde_tidy_palettes( n = 6, palette = c("bde_vivid_pal", "bde_rose_pal", "bde_qual_pal"), alpha = NULL, rev = FALSE )bde_tidy_palettes( n = 6, palette = c("bde_vivid_pal", "bde_rose_pal", "bde_qual_pal"), alpha = NULL, rev = FALSE )
n |
Number of colors to return. Must be at least |
palette |
A valid palette name. |
alpha |
Alpha transparency level in the range |
rev |
Logical. If |
A character vector of hex color codes.
Plotting functions:
scales_bde,
theme_tidybde()
# Show the BdE vivid palette. scales::show_col(bde_tidy_palettes(palette = "bde_vivid_pal"), labels = FALSE ) # Show the BdE rose palette. scales::show_col(bde_tidy_palettes(palette = "bde_rose_pal"), labels = FALSE ) # Show the BdE qualitative palette. scales::show_col(bde_tidy_palettes(palette = "bde_qual_pal"), labels = FALSE )# Show the BdE vivid palette. scales::show_col(bde_tidy_palettes(palette = "bde_vivid_pal"), labels = FALSE ) # Show the BdE rose palette. scales::show_col(bde_tidy_palettes(palette = "bde_rose_pal"), labels = FALSE ) # Show the BdE qualitative palette. scales::show_col(bde_tidy_palettes(palette = "bde_qual_pal"), labels = FALSE )
Color scales for ggplot2. Discrete scales are named
scale_*_bde_d, while continuous scales are named scale_*_bde_c.
scale_color_bde_d( palette = c("bde_vivid_pal", "bde_rose_pal", "bde_qual_pal"), alpha = NULL, rev = FALSE, ... ) scale_fill_bde_d( palette = c("bde_vivid_pal", "bde_rose_pal", "bde_qual_pal"), alpha = NULL, rev = FALSE, ... ) scale_color_bde_c( palette = c("bde_rose_pal", "bde_vivid_pal", "bde_qual_pal"), alpha = NULL, rev = FALSE, guide = "colorbar", ... ) scale_fill_bde_c( palette = c("bde_rose_pal", "bde_vivid_pal", "bde_qual_pal"), alpha = NULL, rev = FALSE, guide = "colorbar", ... )scale_color_bde_d( palette = c("bde_vivid_pal", "bde_rose_pal", "bde_qual_pal"), alpha = NULL, rev = FALSE, ... ) scale_fill_bde_d( palette = c("bde_vivid_pal", "bde_rose_pal", "bde_qual_pal"), alpha = NULL, rev = FALSE, ... ) scale_color_bde_c( palette = c("bde_rose_pal", "bde_vivid_pal", "bde_qual_pal"), alpha = NULL, rev = FALSE, guide = "colorbar", ... ) scale_fill_bde_c( palette = c("bde_rose_pal", "bde_vivid_pal", "bde_qual_pal"), alpha = NULL, rev = FALSE, guide = "colorbar", ... )
palette |
BdE palette to apply. See |
alpha |
Alpha transparency level in the range |
rev |
Logical. If |
... |
Additional arguments passed to |
guide |
A function used to create a guide or its name. See
|
A ggplot2 scale object.
ggplot2::discrete_scale() and ggplot2::continuous_scale() for
the underlying scale constructors.
Plotting functions:
bde_tidy_palettes(),
theme_tidybde()
library(ggplot2) set.seed(596) txsamp <- subset( txhousing, city %in% c( "Houston", "Fort Worth", "San Antonio", "Dallas", "Austin" ) ) ggplot(txsamp, aes(x = sales, y = median)) + geom_point(aes(colour = city)) + scale_color_bde_d() + theme_minimal() ggplot(txsamp, aes(x = sales, y = median)) + geom_point(aes(colour = city)) + scale_color_bde_d("bde_qual_pal") + theme_minimal()library(ggplot2) set.seed(596) txsamp <- subset( txhousing, city %in% c( "Houston", "Fort Worth", "San Antonio", "Dallas", "Austin" ) ) ggplot(txsamp, aes(x = sales, y = median)) + geom_point(aes(colour = city)) + scale_color_bde_d() + theme_minimal() ggplot(txsamp, aes(x = sales, y = median)) + geom_point(aes(colour = city)) + scale_color_bde_d("bde_qual_pal") + theme_minimal()
A custom ggplot2 theme based on BdE publications.
theme_tidybde(...)theme_tidybde(...)
... |
Arguments passed on to
|
This theme extends ggplot2::theme_classic().
A ggplot2 theme object.
ggplot2::theme_classic() for the base theme extended here.
Plotting functions:
bde_tidy_palettes(),
scales_bde
library(ggplot2) library(dplyr) library(tidyr) series_TC <- bde_series_full_load("TC_1_1.csv") # Plot if the download succeeds. if (nrow(series_TC) > 0) { series_TC <- series_TC[c(1, 2)] series_TC_pivot <- series_TC |> filter( Date >= "2020-01-01" & Date <= "2020-12-31", !is.na(series_TC[[2]]) ) names(series_TC_pivot) <- c("x", "y") ggplot(series_TC_pivot, aes(x = x, y = y)) + geom_line(linewidth = 0.8, color = bde_tidy_palettes(n = 1)) + labs( title = "Title", subtitle = "Some metric", caption = "Bank of Spain" ) + theme_tidybde() }library(ggplot2) library(dplyr) library(tidyr) series_TC <- bde_series_full_load("TC_1_1.csv") # Plot if the download succeeds. if (nrow(series_TC) > 0) { series_TC <- series_TC[c(1, 2)] series_TC_pivot <- series_TC |> filter( Date >= "2020-01-01" & Date <= "2020-12-31", !is.na(series_TC[[2]]) ) names(series_TC_pivot) <- c("x", "y") ggplot(series_TC_pivot, aes(x = x, y = y)) + geom_line(linewidth = 0.8, color = bde_tidy_palettes(n = 1)) + labs( title = "Title", subtitle = "Some metric", caption = "Bank of Spain" ) + theme_tidybde() }