diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 90e05c40..3de2551d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,3 +9,4 @@ updates: directory: "/" # Location of package manifests schedule: interval: "weekly" + diff --git a/.github/workflows/cff-validator.yml b/.github/workflows/cff-validator.yml index 8fb70f2b..115aa356 100644 --- a/.github/workflows/cff-validator.yml +++ b/.github/workflows/cff-validator.yml @@ -17,4 +17,5 @@ jobs: uses: actions/checkout@v3 - name: Validate CITATION.cff - uses: dieghernan/cff-validator@main \ No newline at end of file + uses: dieghernan/cff-validator@main + diff --git a/.github/workflows/check-full.yaml b/.github/workflows/check-full.yaml index f078bb9c..c92fc085 100644 --- a/.github/workflows/check-full.yaml +++ b/.github/workflows/check-full.yaml @@ -1,58 +1,59 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/master/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help -# -# NOTE: This workflow is overkill for most R packages and -# check-standard.yaml is likely a better choice. -# usethis::use_github_action("check-standard") will install it. -on: - push: - branches: [main, master] - pull_request: - branches: [main, master] - schedule: - - cron: '0 17 * * 1,4' - -name: R-CMD-check - -jobs: - R-CMD-check: - runs-on: ${{ matrix.config.os }} - - name: ${{ matrix.config.os }} (${{ matrix.config.r }}) - - strategy: - fail-fast: false - matrix: - config: - - {os: windows-latest, r: 'devel'} - - {os: windows-latest, r: 'release'} - - {os: windows-latest, r: 'oldrel'} - #- {os: macOS-latest, r: 'devel'} - - {os: macOS-latest, r: 'release'} - - {os: macOS-latest, r: 'oldrel'} - - {os: ubuntu-latest, r: 'release'} - - {os: ubuntu-latest, r: 'devel'} - - {os: ubuntu-latest, r: 'oldrel'} - - {os: ubuntu-latest, r: '3.6'} - - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} - R_KEEP_PKG_SOURCE: yes - - steps: - - uses: actions/checkout@v3 - - - uses: r-lib/actions/setup-pandoc@v2 - - - uses: r-lib/actions/setup-r@v2 - with: - r-version: ${{ matrix.config.r }} - http-user-agent: ${{ matrix.config.http-user-agent }} - use-public-rspm: true - - - uses: r-lib/actions/setup-r-dependencies@v2 - with: - extra-packages: any::rcmdcheck - needs: check - - - uses: r-lib/actions/check-r-package@v2 +# Workflow derived from https://github.com/r-lib/actions/tree/master/examples +# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +# +# NOTE: This workflow is overkill for most R packages and +# check-standard.yaml is likely a better choice. +# usethis::use_github_action("check-standard") will install it. +on: + push: + branches: [main, master] + pull_request: + branches: [main, master] + schedule: + - cron: '0 17 * * 1,4' + +name: R-CMD-check + +jobs: + R-CMD-check: + runs-on: ${{ matrix.config.os }} + + name: ${{ matrix.config.os }} (${{ matrix.config.r }}) + + strategy: + fail-fast: false + matrix: + config: + - {os: windows-latest, r: 'devel'} + - {os: windows-latest, r: 'release'} + - {os: windows-latest, r: 'oldrel'} + #- {os: macOS-latest, r: 'devel'} + - {os: macOS-latest, r: 'release'} + - {os: macOS-latest, r: 'oldrel'} + - {os: ubuntu-latest, r: 'release'} + - {os: ubuntu-latest, r: 'devel'} + - {os: ubuntu-latest, r: 'oldrel'} + - {os: ubuntu-latest, r: '3.6'} + + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + R_KEEP_PKG_SOURCE: yes + + steps: + - uses: actions/checkout@v3 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: ${{ matrix.config.r }} + http-user-agent: ${{ matrix.config.http-user-agent }} + use-public-rspm: true + + - uses: r-lib/actions/setup-r-dependencies@v2 + with: + extra-packages: any::rcmdcheck + needs: check + + - uses: r-lib/actions/check-r-package@v2 + diff --git a/.github/workflows/cran-status.yaml b/.github/workflows/cran-status.yaml index 0291fb59..ed75e2b6 100644 --- a/.github/workflows/cran-status.yaml +++ b/.github/workflows/cran-status.yaml @@ -8,16 +8,17 @@ on: jobs: check: runs-on: ubuntu-latest - permissions: write-all + permissions: write-all env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout uses: actions/checkout@v3 - + - name: Check uses: dieghernan/cran-status-check@v1 with: fail-on-error: "true" - create-issue: "false" \ No newline at end of file + create-issue: "false" + diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index beda4bce..cdc124ce 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,31 +1,71 @@ -# Workflow derived from https://github.com/r-lib/actions/tree/master/examples -# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# lintr provides static code analysis for R. +# It checks for adherence to a given style, +# identifying syntax errors and possible semantic issues, +# then reports them to you so you can take action. +# More details at https://lintr.r-lib.org/ + +name: lintr + on: push: - branches: [main, master] + branches: + - main + - master + workflow_dispatch: pull_request: - branches: [main, master] + # The branches below must be a subset of the branches above + branches: + - main + - master + schedule: + - cron: '56 11 * * 5' -name: lint +permissions: + contents: read jobs: - lint: + lintr: + name: Run lintr scanning runs-on: ubuntu-latest - env: - GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + permissions: + contents: read # for checkout to fetch code + security-events: write # for github/codeql-action/upload-sarif to upload SARIF results + actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status + steps: - - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v3 - - uses: r-lib/actions/setup-r@v2 + - name: Setup R + uses: r-lib/actions/setup-r@v2 with: use-public-rspm: true - - uses: r-lib/actions/setup-r-dependencies@v2 + - name: Setup lintr + uses: r-lib/actions/setup-r-dependencies@v2 with: - extra-packages: any::lintr - needs: lint + extra-packages: | + local::. + any::lintr - - name: Lint - run: lintr::lint_package() + - name: Run lintr + run: | + # Lintr package + out <- lintr::lint_package() + # Create SARIF report + lintr::sarif_output(out, "lintr-results.sarif") + # Display + out shell: Rscript {0} - \ No newline at end of file + continue-on-error: true + + - name: Upload analysis results to GitHub + uses: github/codeql-action/upload-sarif@v2 + with: + sarif_file: lintr-results.sarif + wait-for-processing: true + diff --git a/.github/workflows/pkgcheck.yaml b/.github/workflows/pkgcheck.yaml new file mode 100644 index 00000000..e7a59842 --- /dev/null +++ b/.github/workflows/pkgcheck.yaml @@ -0,0 +1,21 @@ +name: pkgcheck + +# This will cancel running jobs once a new run is triggered +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +on: + # Manually trigger the Action under Actions/pkgcheck + workflow_dispatch: + +jobs: + pkgcheck: + runs-on: ubuntu-latest + steps: + - uses: ropensci-review-tools/pkgcheck-action@main + with: + summary-only: false + post-to-issue: true + append-to-issue: true + diff --git a/.github/workflows/pkgdown-gh-pages-clean.yaml b/.github/workflows/pkgdown-gh-pages-clean.yaml index c2b8f45e..1f9dcd6c 100644 --- a/.github/workflows/pkgdown-gh-pages-clean.yaml +++ b/.github/workflows/pkgdown-gh-pages-clean.yaml @@ -31,4 +31,5 @@ jobs: run: | git config --local user.name "github-actions[bot]" git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, clean = TRUE)' \ No newline at end of file + Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, clean = TRUE)' + diff --git a/.github/workflows/rostemplate-gh-pages.yaml b/.github/workflows/rostemplate-gh-pages.yaml index ab015661..1fc6bd52 100644 --- a/.github/workflows/rostemplate-gh-pages.yaml +++ b/.github/workflows/rostemplate-gh-pages.yaml @@ -7,7 +7,7 @@ on: tags: ['*'] schedule: - cron: '0 22 15 * *' - + name: rostemplate-gh-pages jobs: @@ -38,4 +38,5 @@ jobs: run: | git config --local user.name "github-actions[bot]" git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" - Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, clean = FALSE)' \ No newline at end of file + Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, clean = FALSE)' + diff --git a/.github/workflows/test-coverage.yaml b/.github/workflows/test-coverage.yaml index cc8fd9fc..90485088 100644 --- a/.github/workflows/test-coverage.yaml +++ b/.github/workflows/test-coverage.yaml @@ -27,5 +27,25 @@ jobs: needs: coverage - name: Test coverage - run: covr::codecov() + run: | + covr::codecov( + quiet = FALSE, + clean = FALSE, + install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") + ) shell: Rscript {0} + + - name: Show testthat output + if: always() + run: | + ## -------------------------------------------------------------------- + find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true + shell: bash + + - name: Upload test results + if: failure() + uses: actions/upload-artifact@v3 + with: + name: coverage-test-failures + path: ${{ runner.temp }}/package + diff --git a/.github/workflows/update-citation-cff.yaml b/.github/workflows/update-citation-cff.yaml index eb836c39..7ff78093 100644 --- a/.github/workflows/update-citation-cff.yaml +++ b/.github/workflows/update-citation-cff.yaml @@ -54,5 +54,3 @@ jobs: git commit -m 'Update CITATION.cff' || echo "No changes to commit" git push origin || echo "No changes to commit" - - diff --git a/.github/workflows/update-docs.yaml b/.github/workflows/update-docs.yaml index db5f34e3..d565ab74 100644 --- a/.github/workflows/update-docs.yaml +++ b/.github/workflows/update-docs.yaml @@ -30,7 +30,7 @@ jobs: - name: Update docs run: | - + pkgdev::update_docs() shell: Rscript {0} @@ -44,7 +44,7 @@ jobs: git push origin || echo "No changes to commit" - uses: r-lib/actions/check-r-package@v2 - + - name: Deploy package run: | git config --local user.name "github-actions[bot]" diff --git a/.github/workflows/wipe-cache.yaml b/.github/workflows/wipe-cache.yaml index d1419a57..cde45a16 100644 --- a/.github/workflows/wipe-cache.yaml +++ b/.github/workflows/wipe-cache.yaml @@ -8,3 +8,4 @@ jobs: steps: - uses: easimon/wipe-cache@main + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..9f46a023 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,46 @@ +# CONTRIBUTING + +## Fixing typos + +Small typos or grammatical errors in documentation may be edited directly using +the GitHub web interface, so long as the changes are made in the *source* file. + +- YES ✔️: you edit a roxygen comment in a `.R` file below `R/`. +- NO ❌: you edit an `.Rd` file below `man/`. + +## Prerequisites + +Before you make a substantial pull request, you should always file an issue and +make sure someone from the team agrees that it's a problem. If you've found a +bug, create an associated issue and illustrate the bug with a minimal +[reprex](https://www.tidyverse.org/help/#reprex). + +## Pull request process + +- We recommend that you create a Git branch for each pull request (PR). +- Look at the `R-CMD-check` build status before. After making changes, run + `devtools::check()` and ensure no new Notes, Warnings or Errors are + appearing. +- We recommend the tidyverse [style guide](http://style.tidyverse.org). We + also use the [styler](https://CRAN.R-project.org/package=styler) package to + apply these styles, but please **don't restyle code that has nothing to do + with your PR**. +- We use [roxygen2](https://cran.r-project.org/package=roxygen2). +- We use [testthat](https://cran.r-project.org/package=testthat). + Contributions with test cases included are easier to accept. +- For user-facing changes, add a bullet to the top of `NEWS.md` below the + current development version header describing the changes made followed by + your GitHub username, and links to relevant issue(s)/PR(s). + +## Prefer to Email? + +Email the person listed as maintainer in the `DESCRIPTION` file of this repo. + +Though note that private discussions over email don't help others - of course +email is totally warranted if it's a sensitive problem of any kind. + +## Thanks for contributing! + +This contributing guide is adapted from the tidyverse contributing guide +available at + diff --git a/R/catalogs.R b/R/catalogs.R index 6659c5ec..9ac657f2 100644 --- a/R/catalogs.R +++ b/R/catalogs.R @@ -7,10 +7,11 @@ #' #' @encoding UTF-8 #' -#' @return A tibble +#' @return A `tibble`. #' #' -#' @source [Time-series bulk data download](https://www.bde.es/webbe/en/estadisticas/recursos/descargas-completas.html) +#' @source [Time-series bulk data +#' download](https://www.bde.es/webbe/en/estadisticas/recursos/descargas-completas.html) #' #' @param catalog A single value indicating the catalogs to be updated #' or `"ALL"` as a shorthand. See **Details**. @@ -205,9 +206,10 @@ bde_catalog_load <- #' #' @encoding UTF-8 #' -#' @return None Downloads the catalog file(s) to the local machine. +#' @return None. Downloads the catalog file(s) to the local machine. #' -#' @source [Time-series bulk data download](https://www.bde.es/webbe/en/estadisticas/recursos/descargas-completas.html) +#' @source [Time-series bulk data +#' download](https://www.bde.es/webbe/en/estadisticas/recursos/descargas-completas.html) #' #' @param catalog A vector of characters indicating the catalogs to be updated #' or `"ALL"` as a shorthand. See **Details**. @@ -306,8 +308,7 @@ bde_catalog_update <- return(result) }) - res <- all(unlist(res)) - return(res) + return(invisible(res)) } #' Search BdE catalogs diff --git a/R/indicators.R b/R/indicators.R index 295261e7..9475004b 100644 --- a/R/indicators.R +++ b/R/indicators.R @@ -17,7 +17,7 @@ #' #' @inheritDotParams bde_series_load -series_code #' -#' @return A tibble with the required series. +#' @return A `tibble` with the required series. #' #' @seealso [bde_series_load()], [bde_catalog_search()] #' diff --git a/R/scales.R b/R/scales.R index 0d159f09..9444a5e9 100644 --- a/R/scales.R +++ b/R/scales.R @@ -2,8 +2,8 @@ #' #' @description #' -#' Scales to be used with the `ggplot2` package. Discrete palettes are named -#' as `scale_*_bde_d` while continuous palettes are named `scale_*_bde_c`. +#' Scales to be used with the \CRANpkg{ggplot2} package. Discrete palettes are +#' named as `scale_*_bde_d` while continuous palettes are named `scale_*_bde_c`. #' #' @seealso [bde_vivid_pal()], [ggplot2::discrete_scale()], #' [ggplot2::continuous_scale()] @@ -18,8 +18,8 @@ #' #' @name scales_bde #' -#' @param palette Name of the BdE palette to apply. One of "bde_vivid_pal", -#' "bde_rose_pal". See [bde_pals()] for details. +#' @param palette Name of the BdE palette to apply. One of `"bde_vivid_pal"`, +#' `"bde_rose_pal"`. See [bde_pals()] for details. #' #' @param ... Further arguments of [ggplot2::discrete_scale()] or #' [ggplot2::continuous_scale()]. diff --git a/R/series.R b/R/series.R index 270c6693..de3994ff 100644 --- a/R/series.R +++ b/R/series.R @@ -24,7 +24,7 @@ #' #' #' @return -#' A tibble with a fiel "Date" and : +#' A `tibble` with a field "Date" and : #' - 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 would have two more columns, @@ -42,13 +42,13 @@ #' a good candidate to be used as the series ID, as it is subject to change. #' If a series changes position in the table, its alias will also change. #' -#' To ensure series can still be identified, even after these changes, they -#' are assigned a sequential number (`series_code` on this function) which -#' will remain unchanged throughout the series' lifetime. +#' To ensure series can still be identified, even after these changes, they +#' are assigned a sequential number (`series_code` on this function) which +#' will remain unchanged throughout the series' lifetime. #' -#' Note that a single series could be used on different tables, so it can have -#' several aliases. If you need to search by alias it is recommended to use -#' [bde_series_full_load()]. +#' Note that a single series could be used on different tables, so it can have +#' several aliases. If you need to search by alias it is recommended to use +#' [bde_series_full_load()]. #' #' @note #' This function tries to coerce the columns to numbers. For some series a diff --git a/R/theme_tidybde.R b/R/theme_tidybde.R index b0739d4b..3d4cd9bb 100644 --- a/R/theme_tidybde.R +++ b/R/theme_tidybde.R @@ -1,6 +1,6 @@ #' BdE `ggplot2` theme #' -#' A custom `ggplot2` theme based on the publications of BdE. +#' A custom \CRANpkg{ggplot2} theme based on the publications of BdE. #' #' @family bde_plot #' diff --git a/R/utils.R b/R/utils.R index 41306ac1..25ffcc7e 100644 --- a/R/utils.R +++ b/R/utils.R @@ -75,19 +75,10 @@ bde_parse_dates <- function(dates_to_parse) { months_esp <- c( - "ENE", - "FEB", - "MAR", - "ABR", - "MAY", - "JUN", - "JUL", - "AGO", - "SEP", - "OCT", - "NOV", - "DIC" + "ENE", "FEB", "MAR", "ABR", "MAY", "JUN", "JUL", "AGO", "SEP", + "OCT", "NOV", "DIC" ) + # Format months for (i in seq_len(length(months_esp))) { dateformat <- gsub(months_esp[i], sprintf("%02d", i), dateformat) diff --git a/README.Rmd b/README.Rmd index 00a161a5..0dac939e 100644 --- a/README.Rmd +++ b/README.Rmd @@ -30,6 +30,7 @@ knitr::opts_chunk$set( [![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) [![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 @@ -62,10 +63,11 @@ Alternatively, you can install the developing version of **tidyBdE** using the [r-universe](https://ropenspain.r-universe.dev/tidyBdE): ```{r, eval = FALSE} -# Install tidyBdE -install.packages("tidyBdE", - repos = c("https://ropenspain.r-universe.dev", "https://cloud.r-project.org") -) +# Install tidyBdE in R: +install.packages("tidyBdE", repos = c( + "https://ropenspain.r-universe.dev", + "https://cloud.r-project.org" +)) ``` ## Examples diff --git a/README.md b/README.md index 8d9c294e..efe9a478 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ [![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) [![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 @@ -47,10 +48,11 @@ Alternatively, you can install the developing version of **tidyBdE** using the [r-universe](https://ropenspain.r-universe.dev/tidyBdE): ``` r -# Install tidyBdE -install.packages("tidyBdE", - repos = c("https://ropenspain.r-universe.dev", "https://cloud.r-project.org") -) +# Install tidyBdE in R: +install.packages("tidyBdE", repos = c( + "https://ropenspain.r-universe.dev", + "https://cloud.r-project.org" +)) ``` ## Examples diff --git a/codemeta.json b/codemeta.json index 88cec909..39fe7539 100644 --- a/codemeta.json +++ b/codemeta.json @@ -14,7 +14,7 @@ "name": "R", "url": "https://r-project.org" }, - "runtimePlatform": "R version 4.3.1 (2023-06-16 ucrt)", + "runtimePlatform": "R version 4.3.1 (2023-06-16)", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -180,7 +180,7 @@ }, "applicationCategory": "Macroeconomics", "isPartOf": "https://ropenspain.es/", - "fileSize": "771.447KB", + "fileSize": "507.164KB", "citation": [ { "@type": "SoftwareSourceCode", diff --git a/inst/WORDLIST b/inst/WORDLIST index 9f2ce811..2868d0ef 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -3,6 +3,7 @@ BdE CMD CatastRo Catastro +CodeFactor DOI Datos Descripcion @@ -38,7 +39,6 @@ del diarios electrónica esterlinas -fiel geospatial halfyear hcl diff --git a/inst/schemaorg.json b/inst/schemaorg.json new file mode 100644 index 00000000..83cf7b46 --- /dev/null +++ b/inst/schemaorg.json @@ -0,0 +1,45 @@ +{ + "@context": "https://schema.org", + "@graph": [ + { + "type": "SoftwareSourceCode", + "author": { + "id": "https://orcid.org/0000-0001-8457-4658" + }, + "codeRepository": "https://github.com/rOpenSpain/tidyBdE", + "copyrightHolder": { + "id": "https://orcid.org/0000-0001-8457-4658", + "type": "Person", + "email": "dev.dieghernan@gmail.com", + "familyName": "H. Herrero", + "givenName": "Diego" + }, + "description": "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'.", + "license": "https://spdx.org/licenses/GPL-3.0", + "name": "tidyBdE: Download Data from Bank of Spain", + "programmingLanguage": { + "type": "ComputerLanguage", + "name": "R", + "url": "https://r-project.org" + }, + "provider": { + "id": "https://cran.r-project.org", + "type": "Organization", + "name": "Comprehensive R Archive Network (CRAN)", + "url": "https://cran.r-project.org" + }, + "runtimePlatform": "R version 4.3.1 (2023-06-16)", + "version": "0.3.4" + }, + { + "id": "https://doi.org/10.5281/zenodo.4673496", + "type": "SoftwareSourceCode", + "author": { + "type": "Person", + "familyName": "H. Herrero", + "givenName": "Diego" + }, + "name": "{tidyBdE}: Download Data from Bank of Spain" + } + ] +} diff --git a/man/bde_catalog_load.Rd b/man/bde_catalog_load.Rd index 5fa6a760..3ab4132f 100644 --- a/man/bde_catalog_load.Rd +++ b/man/bde_catalog_load.Rd @@ -33,7 +33,7 @@ the \code{cache_dir}.} debugging.} } \value{ -A tibble +A \code{tibble}. } \description{ Load the time-series catalogs provided by BdE. diff --git a/man/bde_catalog_update.Rd b/man/bde_catalog_update.Rd index 00a66f10..b1d2bbbe 100644 --- a/man/bde_catalog_update.Rd +++ b/man/bde_catalog_update.Rd @@ -25,7 +25,7 @@ via options with \code{options(bde_cache_dir = "path/to/dir")}.} debugging.} } \value{ -None Downloads the catalog file(s) to the local machine. +None. Downloads the catalog file(s) to the local machine. } \description{ Update the time-series catalogs provided by BdE. diff --git a/man/bde_indicators.Rd b/man/bde_indicators.Rd index c5c435d7..c5e4e0f8 100644 --- a/man/bde_indicators.Rd +++ b/man/bde_indicators.Rd @@ -59,7 +59,7 @@ debugging.} }} } \value{ -A tibble with the required series. +A \code{tibble} with the required series. } \description{ Set of helper functions for downloading some of the most relevant diff --git a/man/bde_series_load.Rd b/man/bde_series_load.Rd index 417a53de..f53cb6fe 100644 --- a/man/bde_series_load.Rd +++ b/man/bde_series_load.Rd @@ -49,7 +49,7 @@ debugging.} metadata of the requested series.} } \value{ -A tibble with a fiel "Date" and : +A \code{tibble} with a field "Date" and : \itemize{ \item With \code{out_format = "wide"} each series is presented in a separate column with the name defined by \code{series_label}. diff --git a/man/figures/README-chart-1.png b/man/figures/README-chart-1.png index df07772a..5a9e1379 100644 Binary files a/man/figures/README-chart-1.png and b/man/figures/README-chart-1.png differ diff --git a/man/figures/README-macroseries-1.png b/man/figures/README-macroseries-1.png index 1a5da069..47849d81 100644 Binary files a/man/figures/README-macroseries-1.png and b/man/figures/README-macroseries-1.png differ diff --git a/man/figures/README-palettes-1.png b/man/figures/README-palettes-1.png index 958be7fb..1a841543 100644 Binary files a/man/figures/README-palettes-1.png and b/man/figures/README-palettes-1.png differ diff --git a/man/figures/README-palettes-2.png b/man/figures/README-palettes-2.png index 33e781c7..9afa2742 100644 Binary files a/man/figures/README-palettes-2.png and b/man/figures/README-palettes-2.png differ diff --git a/man/scales_bde.Rd b/man/scales_bde.Rd index 62b42879..dc17a8ff 100644 --- a/man/scales_bde.Rd +++ b/man/scales_bde.Rd @@ -17,8 +17,8 @@ scale_color_bde_c(palette = c("bde_vivid_pal", "bde_rose_pal"), ...) scale_fill_bde_c(palette = c("bde_vivid_pal", "bde_rose_pal"), ...) } \arguments{ -\item{palette}{Name of the BdE palette to apply. One of "bde_vivid_pal", -"bde_rose_pal". See \code{\link[=bde_pals]{bde_pals()}} for details.} +\item{palette}{Name of the BdE palette to apply. One of \code{"bde_vivid_pal"}, +\code{"bde_rose_pal"}. See \code{\link[=bde_pals]{bde_pals()}} for details.} \item{...}{Further arguments of \code{\link[ggplot2:discrete_scale]{ggplot2::discrete_scale()}} or \code{\link[ggplot2:continuous_scale]{ggplot2::continuous_scale()}}.} @@ -27,8 +27,8 @@ scale_fill_bde_c(palette = c("bde_vivid_pal", "bde_rose_pal"), ...) A \code{ggplot2} color scale. } \description{ -Scales to be used with the \code{ggplot2} package. Discrete palettes are named -as \verb{scale_*_bde_d} while continuous palettes are named \verb{scale_*_bde_c}. +Scales to be used with the \CRANpkg{ggplot2} package. Discrete palettes are +named as \verb{scale_*_bde_d} while continuous palettes are named \verb{scale_*_bde_c}. } \seealso{ \code{\link[=bde_vivid_pal]{bde_vivid_pal()}}, \code{\link[ggplot2:discrete_scale]{ggplot2::discrete_scale()}}, diff --git a/man/theme_tidybde.Rd b/man/theme_tidybde.Rd index 8c676657..0f4d82a8 100644 --- a/man/theme_tidybde.Rd +++ b/man/theme_tidybde.Rd @@ -20,7 +20,7 @@ theme_tidybde(...) A \code{\link[ggplot2:ggtheme]{ggplot2::theme_classic()}}. } \description{ -A custom \code{ggplot2} theme based on the publications of BdE. +A custom \CRANpkg{ggplot2} theme based on the publications of BdE. } \details{ Theme based on \code{\link[ggplot2:ggtheme]{ggplot2::theme_classic()}}. diff --git a/tidyBdE.Rproj b/tidyBdE.Rproj index 151ebc71..7e9b83f7 100644 --- a/tidyBdE.Rproj +++ b/tidyBdE.Rproj @@ -12,6 +12,10 @@ Encoding: UTF-8 RnwWeave: Sweave LaTeX: pdfLaTeX +AutoAppendNewline: Yes +StripTrailingWhitespace: Yes +LineEndingConversion: Posix + BuildType: Package PackageUseDevtools: Yes PackageInstallArgs: --no-multiarch --with-keep.source diff --git a/vignettes/chart-1.png b/vignettes/chart-1.png deleted file mode 100644 index bdf45dee..00000000 Binary files a/vignettes/chart-1.png and /dev/null differ diff --git a/vignettes/macroseries-1.png b/vignettes/macroseries-1.png deleted file mode 100644 index aba23d3c..00000000 Binary files a/vignettes/macroseries-1.png and /dev/null differ diff --git a/vignettes/tidyBdE.Rmd b/vignettes/tidyBdE.Rmd index c793e6cf..5d208ea9 100644 --- a/vignettes/tidyBdE.Rmd +++ b/vignettes/tidyBdE.Rmd @@ -7,6 +7,8 @@ vignette: > %\VignetteEncoding{UTF-8} --- + + **tidyBdE** is an API package that helps to retrieve data from [Banco de @@ -104,10 +106,8 @@ ggplot(time_series, aes(x = Date, y = EUR_GBP_XR)) + theme_tidybde() ``` -
-EUR/GBP Exchange Rate (2010-2020) via tidyBdE -

EUR/GBP Exchange Rate (2010-2020) via tidyBdE

-
+![EUR/GBP Exchange Rate (2010-2020) via +tidyBdE](../man/figures/README-chart-1.png) 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 @@ -135,10 +135,8 @@ ggplot(plotseries, aes(x = Date, y = serie_value)) + scale_color_bde_d(palette = "bde_vivid_pal") # Custom palette on the package ``` -
-Spanish Economic Indicators (2010-2019) -

Spanish Economic Indicators (2010-2019)

-
+![Spanish Economic Indicators +(2010-2019)](../man/figures/README-macroseries-1.png) ## A note on caching diff --git a/vignettes/tidyBdE.Rmd.orig b/vignettes/tidyBdE.Rmd.orig index 021cc0f3..2d5e455e 100644 --- a/vignettes/tidyBdE.Rmd.orig +++ b/vignettes/tidyBdE.Rmd.orig @@ -7,9 +7,9 @@ vignette: > %\VignetteEncoding{UTF-8} --- -```{r, include = FALSE} + -start_time <- Sys.time() +```{r, include = FALSE} knitr::opts_chunk$set( collapse = TRUE, @@ -23,6 +23,8 @@ knitr::opts_chunk$set( out.width = "100%" ) +library(tidyBdE) + ``` **tidyBdE** is an API package that helps to retrieve data from [Banco de @@ -51,11 +53,11 @@ library(tidyr) # Search GBP on "TC" (exchange rate) catalog XR_GBP <- bde_catalog_search("GBP", catalog="TC") -XR_GBP %>% +XR_GBP %>% select(Numero_secuencial, Descripcion_de_la_serie) %>% - # To table on document + # To table on document knitr::kable() - + ``` @@ -91,7 +93,7 @@ time_series <- bde_series_load(seq_number, series_label = "EUR_GBP_XR") %>% The package also provides a custom `ggplot2` theme based on the publications of BdE: -```{r chart, fig.asp=0.7, fig.cap="EUR/GBP Exchange Rate (2010-2020) via tidyBdE"} +```{r chart, eval=FALSE} ggplot(time_series, aes(x = Date, y = EUR_GBP_XR)) + geom_line(colour = bde_vivid_pal()(1)) + @@ -111,11 +113,14 @@ ggplot(time_series, aes(x = Date, y = EUR_GBP_XR)) + ``` +![EUR/GBP Exchange Rate (2010-2020) via +tidyBdE](../man/figures/README-chart-1.png) + 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 macroseries, fig.asp=0.7, fig.cap = "Spanish Economic Indicators (2010-2019)"} +```{r macroseries, eval=FALSE, fig.asp=0.7, fig.cap = "Spanish Economic Indicators (2010-2019)"} # Data in "long" format @@ -138,6 +143,9 @@ ggplot(plotseries, aes(x = Date, y = serie_value)) + ``` +![Spanish Economic Indicators +(2010-2019)](../man/figures/README-macroseries-1.png) + ## A note on caching You can use **tidyBdE** to create your own local repository at a given local