https://github.com/m-muecke/ecbr
R client for the European Central Bank (ECB) API
https://github.com/m-muecke/ecbr
ecb r
Last synced: over 1 year ago
JSON representation
R client for the European Central Bank (ECB) API
- Host: GitHub
- URL: https://github.com/m-muecke/ecbr
- Owner: m-muecke
- License: other
- Archived: true
- Created: 2024-01-28T16:07:53.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-07-03T13:13:03.000Z (almost 2 years ago)
- Last Synced: 2025-03-15T01:42:59.568Z (over 1 year ago)
- Topics: ecb, r
- Language: R
- Homepage: https://m-muecke.github.io/ecbr/
- Size: 5.51 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
options(tibble.print_min = 5L, tibble.print_max = 5L)
```
# ecbr
[](https://lifecycle.r-lib.org/articles/stages.html#superseded)
[](https://github.com/m-muecke/ecbr/actions/workflows/R-CMD-check.yaml)
> Note this package is retired in favor of the [bbk](https://github.com/m-muecke/bbk) package,
> which provides additional central bank data sources.
ecbr is a minimal R client for the [ECB API](https://data.ecb.europa.eu/help/api/overview).
## Installation
You can install the development version of ecbr from [GitHub](https://github.com/) with:
```{r, eval = FALSE}
# install.packages("pak")
pak::pak("m-muecke/ecbr")
```
## Usage
```{r demo, message = FALSE}
library(ecbr)
# fetch US dollar/Euro exchange rate
fx_rate <- ecb_data("EXR", "D.USD.EUR.SP00.A", start_period = "2021-01-01")
fx_rate
```
```{r plotting, message = FALSE, echo = FALSE, dpi = 300}
library(ggplot2)
title <- tools::toTitleCase(fx_rate[1, "title", drop = TRUE])
subtitle <- fx_rate[1, "description", drop = TRUE]
ggplot(fx_rate, aes(x = date, y = value)) +
geom_line() +
theme_minimal() +
theme(
plot.title = element_text(face = "bold"),
panel.grid.major.y = element_line(color = "black", linewidth = 0.2),
panel.grid.major.x = element_blank(),
panel.grid.minor = element_blank(),
axis.text = element_text(color = "black"),
axis.title = element_blank()
) +
scale_y_continuous(labels = scales::label_currency()) +
labs(title = title, subtitle = subtitle)
```
## Related work
* [ecb](https://github.com/expersso/ecb): R interface to the European Central Bank's Statistical Data Warehouse (SDW) API.
* [rsdmx](https://github.com/opensdmx/rsdmx): R package for reading SDMX data and metadata.
* [readsdmx](https://github.com/mdequeljoe/readsdmx): R package for reading SDMX data and metadata.
* [pdfetch](https://github.com/abielr/pdfetch): R package for downloading economic and financial time series from public sources.