Skip to content

Commit

Permalink
Add actions
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Apr 22, 2024
1 parent fd08256 commit 4f181c0
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 67 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@
^CODE_OF_CONDUCT\.md$
^CONTRIBUTING\.md$
^Rplots\.pdf$
^codecov\.yml$
96 changes: 96 additions & 0 deletions .github/workflows/rhub.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# R-hub's generic GitHub Actions workflow file. It's canonical location is at
# https://github.com/r-hub/actions/blob/v1/workflows/rhub.yaml
# You can update this file to a newer version using the rhub2 package:
#
# rhub::rhub_setup()
#
# It is unlikely that you need to modify this file manually.

name: R-hub
run-name: "${{ github.event.inputs.id }}: ${{ github.event.inputs.name || format('Manually run by {0}', github.triggering_actor) }}"

on:
workflow_dispatch:
inputs:
config:
description: 'A comma separated list of R-hub platforms to use.'
type: string
default: 'linux,windows,macos'
name:
description: 'Run name. You can leave this empty now.'
type: string
id:
description: 'Unique ID. You can leave this empty now.'
type: string

jobs:

setup:
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.rhub-setup.outputs.containers }}
platforms: ${{ steps.rhub-setup.outputs.platforms }}

steps:
# NO NEED TO CHECKOUT HERE
- uses: r-hub/actions/setup@v1
with:
config: ${{ github.event.inputs.config }}
id: rhub-setup

linux-containers:
needs: setup
if: ${{ needs.setup.outputs.containers != '[]' }}
runs-on: ubuntu-latest
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.containers) }}
container:
image: ${{ matrix.config.container }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/run-check@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}

other-platforms:
needs: setup
if: ${{ needs.setup.outputs.platforms != '[]' }}
runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.label }}
strategy:
fail-fast: false
matrix:
config: ${{ fromJson(needs.setup.outputs.platforms) }}

steps:
- uses: r-hub/actions/checkout@v1
- uses: r-hub/actions/setup-r@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/platform-info@v1
with:
token: ${{ secrets.RHUB_TOKEN }}
job-config: ${{ matrix.config.job-config }}
- uses: r-hub/actions/setup-deps@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}
- uses: r-hub/actions/run-check@v1
with:
job-config: ${{ matrix.config.job-config }}
token: ${{ secrets.RHUB_TOKEN }}

7 changes: 4 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# -----------------------------------------------------------
# CITATION file created with {cffr} R package, v1.0.0
# --------------------------------------------
# CITATION file created with {cffr} R package
# See also: https://docs.ropensci.org/cffr/
# -----------------------------------------------------------
# --------------------------------------------

cff-version: 1.2.0
message: 'To cite package "tidyBdE" in publications use:'
Expand Down Expand Up @@ -297,3 +297,4 @@ references:
email: [email protected]
year: '2024'
version: '>= 3.0.0'

5 changes: 2 additions & 3 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ knitr::opts_chunk$set(
[![On-CRAN](https://www.r-pkg.org/badges/ago/tidyBdE)](https://cran.r-project.org/web/checks/check_results_tidyBdE.html)
[![r-universe](https://ropenspain.r-universe.dev/badges/tidyBdE)](https://ropenspain.r-universe.dev/tidyBdE)
[![R-CMD-check](https://github.com/rOpenSpain/tidyBdE/actions/workflows/check-full.yaml/badge.svg)](https://github.com/rOpenSpain/tidyBdE/actions/workflows/check-full.yaml)
[![R-hub](https://github.com/rOpenSpain/tidyBdE/actions/workflows/rhub.yaml/badge.svg)](https://github.com/rOpenSpain/tidyBdE/actions/workflows/rhub.yaml)
[![codecov](https://codecov.io/gh/ropenspain/tidyBdE/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ropenspain/tidyBdE)
[![CodeFactor](https://www.codefactor.io/repository/github/ropenspain/tidybde/badge)](https://www.codefactor.io/repository/github/ropenspain/tidybde)
[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.4673496-blue)](https://doi.org/10.5281/zenodo.4673496)
Expand All @@ -55,9 +56,7 @@ install.packages("tidyBdE")
You can install the developing version of **tidyBdE** with:

```{r, eval = FALSE}
library(remotes)
install_github("ropenspain/tidyBdE")
remotes::install_github("ropenspain/tidyBdE")
```

Alternatively, you can install the developing version of **tidyBdE** using the
Expand Down
115 changes: 55 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->

# tidyBdE <img src="man/figures/logo.png" align="right" width="120"/>
Expand All @@ -12,25 +11,25 @@
[![On-CRAN](https://www.r-pkg.org/badges/ago/tidyBdE)](https://cran.r-project.org/web/checks/check_results_tidyBdE.html)
[![r-universe](https://ropenspain.r-universe.dev/badges/tidyBdE)](https://ropenspain.r-universe.dev/tidyBdE)
[![R-CMD-check](https://github.com/rOpenSpain/tidyBdE/actions/workflows/check-full.yaml/badge.svg)](https://github.com/rOpenSpain/tidyBdE/actions/workflows/check-full.yaml)
[![R-hub](https://github.com/rOpenSpain/tidyBdE/actions/workflows/rhub.yaml/badge.svg)](https://github.com/rOpenSpain/tidyBdE/actions/workflows/rhub.yaml)
[![codecov](https://codecov.io/gh/ropenspain/tidyBdE/branch/main/graph/badge.svg)](https://app.codecov.io/gh/ropenspain/tidyBdE)
[![CodeFactor](https://www.codefactor.io/repository/github/ropenspain/tidybde/badge)](https://www.codefactor.io/repository/github/ropenspain/tidybde)
[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.4673496-blue)](https://doi.org/10.5281/zenodo.4673496)
[![Project Status: Active – The project has reached a stable, usable
state and is being actively
[![Project Status: Active – The project has reached a stable, usable state and
is being actively
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)

<!-- badges: end -->

**tidyBdE** is an API package that helps to retrieve data from [Banco de
España](https://www.bde.es/webbe/en/estadisticas/recursos/descargas-completas.html).
The data is returned as a [`tibble`](https://tibble.tidyverse.org/) and
the package tries to guess the format of every time-series (dates,
characters and numbers).
The data is returned as a [`tibble`](https://tibble.tidyverse.org/) and the
package tries to guess the format of every time-series (dates, characters and
numbers).

## Installation

Install **tidyBdE** from
[**CRAN**](https://CRAN.R-project.org/package=tidyBdE):
Install **tidyBdE** from [**CRAN**](https://CRAN.R-project.org/package=tidyBdE):

``` r
install.packages("tidyBdE")
Expand All @@ -44,8 +43,8 @@ library(remotes)
install_github("ropenspain/tidyBdE")
```

Alternatively, you can install the developing version of **tidyBdE**
using the [r-universe](https://ropenspain.r-universe.dev/tidyBdE):
Alternatively, you can install the developing version of **tidyBdE** using the
[r-universe](https://ropenspain.r-universe.dev/tidyBdE):

``` r
# Install tidyBdE in R:
Expand All @@ -57,12 +56,12 @@ install.packages("tidyBdE", repos = c(

## Examples

Banco de España (**BdE**) provides several time-series, either produced
by the institution itself or compiled for another sources, as
Banco de España (**BdE**) provides several time-series, either produced by the
institution itself or compiled for another sources, as
[Eurostat](https://ec.europa.eu/eurostat) or [INE](https://www.ine.es/).

The basic entry point for searching time-series are the catalogs
(*indexes*) of information. You can search any series by name:
The basic entry point for searching time-series are the catalogs (*indexes*) of
information. You can search any series by name:

``` r
library(tidyBdE)
Expand All @@ -86,13 +85,12 @@ XR_GBP %>%
|------------------:|:-------------------------------------------------------------------|
| 573214 | Tipo de cambio. Libras esterlinas por euro (GBP/EUR).Datos diarios |

**Note that BdE files are only provided in Spanish, for the time
being**, the organism is working on the English version. By now, search
terms should be provided in Spanish in order to get search results.
**Note that BdE files are only provided in Spanish, for the time being**, the
organism is working on the English version. By now, search terms should be
provided in Spanish in order to get search results.

After we have found our series, we can load the series for the GBP/EUR
exchange rate using the sequential number reference
(`Numero_Secuencial`) as:
After we have found our series, we can load the series for the GBP/EUR exchange
rate using the sequential number reference (`Numero_Secuencial`) as:

``` r
seq_number <- XR_GBP %>%
Expand All @@ -111,8 +109,8 @@ time_series <- bde_series_load(seq_number, series_label = "EUR_GBP_XR") %>%

### Plots

The package also provides a custom **ggplot2** theme based on the
publications of BdE:
The package also provides a custom **ggplot2** theme based on the publications
of BdE:

``` r
ggplot(time_series, aes(x = Date, y = EUR_GBP_XR)) +
Expand All @@ -136,11 +134,11 @@ ggplot(time_series, aes(x = Date, y = EUR_GBP_XR)) +
theme_tidybde()
```

<img src="man/figures/README-chart-1.png" width="100%" />
<img src="man/figures/README-chart-1.png" width="100%"/>

The package provides also several “shortcut” functions for a selection
of the most relevant macroeconomic series, so there is no need to look
for them in advance:
The package provides also several “shortcut” functions for a selection of the
most relevant macroeconomic series, so there is no need to look for them in
advance:

``` r
# Data in "long" format
Expand All @@ -163,32 +161,30 @@ ggplot(plotseries, aes(x = Date, y = serie_value)) +
scale_color_bde_d(palette = "bde_vivid_pal") # Custom palette on the package
```

<img src="man/figures/README-macroseries-1.png" width="100%" />
<img src="man/figures/README-macroseries-1.png" width="100%"/>

### Palettes

Two custom palettes, based on the used by BdE on some publications are
available.

Those palettes can be applied to a `ggplot2` using some custom utils
included on the package (see
`help("scale_color_bde_d", package = "tidyBdE")`).
Those palettes can be applied to a `ggplot2` using some custom utils included on
the package (see `help("scale_color_bde_d", package = "tidyBdE")`).

### A note on caching

You can use **tidyBdE** to create your own local repository at a given
local directory passing the following option:
You can use **tidyBdE** to create your own local repository at a given local
directory passing the following option:

``` r
options(bde_cache_dir = "./path/to/location")
```

When this option is set, **tidyBdE** would look for the cached file on
the `bde_cache_dir` directory and it will load it, speeding up the
process.
When this option is set, **tidyBdE** would look for the cached file on the
`bde_cache_dir` directory and it will load it, speeding up the process.

It is possible to update the data (i.e. after every monthly or quarterly
data release) with the following commands:
It is possible to update the data (i.e. after every monthly or quarterly data
release) with the following commands:

``` r
bde_catalog_update()
Expand All @@ -202,36 +198,35 @@ bde_series_load("SOME ID", update_cache = TRUE)

Other useful packages that provides access to Spanish open data:

- [**MicroDatosEs**](https://github.com/rOpenSpain/MicroDatosEs): A
package that process microdata provided by Spanish statistical
agencies (mostly, INE).
- [**CatastRo**](https://github.com/rOpenSpain/CatastRo): A package that
queries Sede electrónica del Catastro API.
- [**mapSpain**](https://ropenspain.github.io/mapSpain/): For
downloading geospatial information from Instituto Geográfico Nacional
(IGN) and creating maps of Spain.
- [**MicroDatosEs**](https://github.com/rOpenSpain/MicroDatosEs): A package
that process microdata provided by Spanish statistical agencies (mostly,
INE).
- [**CatastRo**](https://github.com/rOpenSpain/CatastRo): A package that
queries Sede electrónica del Catastro API.
- [**mapSpain**](https://ropenspain.github.io/mapSpain/): For downloading
geospatial information from Instituto Geográfico Nacional (IGN) and creating
maps of Spain.

## Disclaimer

This package is in no way sponsored endorsed or administered by Banco de
España.
This package is in no way sponsored endorsed or administered by Banco de España.

## Citation

<p>
H. Herrero D (2024). <em>tidyBdE: Download Data from Bank of Spain</em>.
<p>H. Herrero D (2024). <em>tidyBdE: Download Data from Bank of Spain</em>.
<a href="https://doi.org/10.5281/zenodo.4673496">doi:10.5281/zenodo.4673496</a>,
<a href="https://ropenspain.github.io/tidyBdE/">https://ropenspain.github.io/tidyBdE/</a>.
</p>
<a href="https://ropenspain.github.io/tidyBdE/">https://ropenspain.github.io/tidyBdE/</a>.</p>

A BibTeX entry for LaTeX users is

@Manual{R-tidyBdE,
title = {{tidyBdE}: Download Data from Bank of Spain},
doi = {10.5281/zenodo.4673496},
author = {Diego {H. Herrero}},
year = {2024},
version = {0.3.5.9000},
url = {https://ropenspain.github.io/tidyBdE/},
abstract = {Tools to download data series from Banco de España (BdE) on tibble format. 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 along with the European Central Bank. This package is in no way sponsored endorsed or administered by Banco de España.},
}
```
@Manual{R-tidyBdE,
title = {{tidyBdE}: Download Data from Bank of Spain},
doi = {10.5281/zenodo.4673496},
author = {Diego {H. Herrero}},
year = {2024},
version = {0.3.5.9000},
url = {https://ropenspain.github.io/tidyBdE/},
abstract = {Tools to download data series from Banco de España (BdE) on tibble format. 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 along with the European Central Bank. This package is in no way sponsored endorsed or administered by Banco de España.},
}
```
3 changes: 3 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
codecov:
token: ebd5e3f5-b5e5-4a82-8e65-e347d1392d38

2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@
},
"applicationCategory": "Macroeconomics",
"isPartOf": "https://ropenspain.es/",
"fileSize": "289.392KB",
"fileSize": "289.071KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down

0 comments on commit 4f181c0

Please sign in to comment.