knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
An R package to provide convenient access to the Bank of Canada data API.
canbank R package home page and reference guide
You can install the released version of canbank from CRAN with:
remotes::install_github("mountainmath/canbank")
The package can import data for one or several Bank of Canada time series or series groups. For example, to access the series group "SAN_MIKA20210428_C1" with metrics pertaining to house price growth in Canada we can easily retrieve the data using the get_boc_series_group
method.
library(canbank) library(dplyr) library(ggplot2) ## basic example code data <- get_boc_series_group("SAN_MIKA20210428_C1") %>% mutate(name=gsub(" \\(.+$","",label)) %>% filter(!is.na(Value)) ggplot(data,aes(x=Date,y=Value)) + geom_line() + facet_wrap(~name, scales="free") + labs(title="House price metrics", y=NULL,x=NULL, caption="Bank of Canada series group SAN_MIKA20210428_C1")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.