Note this package is retired in favor of the bbk package, which provides additional central bank data sources.
ecbr is a minimal R client for the ECB API.
You can install the development version of ecbr from GitHub with:
# install.packages("pak")
pak::pak("m-muecke/ecbr")
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
#> # A tibble: 898 × 16
#> date key value title description freq currency currency_denom
#> <date> <chr> <dbl> <chr> <chr> <chr> <chr> <chr>
#> 1 2021-01-04 D.USD.EUR.SP… 1.23 US d… ECB refere… daily USD EUR
#> 2 2021-01-05 D.USD.EUR.SP… 1.23 US d… ECB refere… daily USD EUR
#> 3 2021-01-06 D.USD.EUR.SP… 1.23 US d… ECB refere… daily USD EUR
#> 4 2021-01-07 D.USD.EUR.SP… 1.23 US d… ECB refere… daily USD EUR
#> 5 2021-01-08 D.USD.EUR.SP… 1.23 US d… ECB refere… daily USD EUR
#> # ℹ 893 more rows
#> # ℹ 8 more variables: exr_type <chr>, exr_suffix <chr>, decimals <chr>,
#> # source_agency <chr>, time_format <chr>, collection <chr>, unit_mult <chr>,
#> # unit <chr>