Skip to content

Commit

Permalink
Rename funs
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Jan 29, 2024
1 parent ad39592 commit 86401c6
Show file tree
Hide file tree
Showing 34 changed files with 172 additions and 162 deletions.
35 changes: 0 additions & 35 deletions .github/workflows/pkgdown-gh-pages-clean.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/rostemplate-gh-pages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +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)'
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE, clean = TRUE)'
3 changes: 2 additions & 1 deletion .github/workflows/wipe-cache.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: Clear GHA caches manually
on:
workflow_dispatch:

schedule:
- cron: '0 22 2 * *'
jobs:
cache-clear:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ message: 'To cite package "tidyBdE" in publications use:'
type: software
license: GPL-3.0-or-later
title: 'tidyBdE: Download Data from Bank of Spain'
version: 0.3.4.9000
version: 0.3.5
doi: 10.5281/zenodo.4673496
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
Expand All @@ -32,7 +32,7 @@ preferred-citation:
affiliation: rOpenSpain
doi: 10.5281/zenodo.4673496
year: '2024'
version: 0.3.4.9000
version: 0.3.5
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
Expand Down
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: tidyBdE
Title: Download Data from Bank of Spain
Version: 0.3.4.9000
Version: 0.3.5
Authors@R:
person("Diego", "H. Herrero", , "[email protected]", role = c("aut", "cre", "cph"),
comment = c(ORCID = "0000-0001-8457-4658", affiliation = "rOpenSpain"))
Expand Down Expand Up @@ -32,7 +32,8 @@ Suggests:
VignetteBuilder:
knitr
Config/Needs/coverage: covr
Config/Needs/website: reactable, styler, tidyverse, ropenspain/rostemplate
Config/Needs/website: reactable, styler, tidyverse,
ropenspain/rostemplate, devtools
Config/testthat/edition: 3
Config/testthat/parallel: true
Copyright: See file inst/COPYRIGHTS
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ export(bde_ind_ibex_daily)
export(bde_ind_ibex_monthly)
export(bde_ind_population)
export(bde_ind_unemployment_rate)
export(bde_palettes)
export(bde_parse_dates)
export(bde_rose_pal)
export(bde_series_full_load)
export(bde_series_load)
export(bde_tidy_palettes)
export(bde_vivid_pal)
export(scale_color_bde_c)
export(scale_color_bde_d)
Expand Down
7 changes: 4 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# tidyBdE (development version)
# tidyBdE 0.3.5

Mostly changes on the color functions:

- `bde_vivid_pal()` and `bde_rose_pal()` have been superseded. Use the new
function `bde_palettes()` instead.
- `scale_color_bde_d()` and friends leverage now on `bde_palettes()`, and
function `bde_tidy_palettes()` instead.
- `scale_color_bde_d()` and friends leverage now on `bde_tidy_palettes()`, and
these functions gain two new arguments: `alpha` y `rev`.
- Update and review documentation.
- New palette named `bde_qual_pal`.

# tidyBdE 0.3.4

Expand Down
21 changes: 17 additions & 4 deletions R/bde_palettes.R → R/bde_tidy_palettes.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,21 @@
#' @examples
#'
#' # BdE vivid pal
#' scales::show_col(bde_palettes(palette = "bde_vivid_pal"), labels = FALSE)
#' scales::show_col(bde_tidy_palettes(palette = "bde_vivid_pal"),
#' labels = FALSE
#' )
#'
#' # BdE rose pal
#' scales::show_col(bde_palettes(palette = "bde_rose_pal"), labels = FALSE)
bde_palettes <- function(n = 6, palette = c("bde_vivid_pal", "bde_rose_pal"),
alpha = NULL, rev = FALSE) {
#' scales::show_col(bde_tidy_palettes(palette = "bde_rose_pal"), labels = FALSE)
#'
#' # BdE qual pal
#' scales::show_col(bde_tidy_palettes(palette = "bde_qual_pal"), labels = FALSE)
bde_tidy_palettes <- function(n = 6,
palette = c(
"bde_vivid_pal", "bde_rose_pal",
"bde_qual_pal"
),
alpha = NULL, rev = FALSE) {
palette <- match.arg(palette)

cols <- switch(palette,
Expand All @@ -36,6 +45,10 @@ bde_palettes <- function(n = 6, palette = c("bde_vivid_pal", "bde_rose_pal"),
"bde_rose_pal" = c(
"#b7365c", "#cb6e8a", "#db9aad",
"#0a50a1", "#5385bd", "#89AEDA"
),
"bde_qual_pal" = c(
"#b55b4a", "#2e76bc", "#fece64",
"#68be57", "#858788", "#f9b4af"
)
)

Expand Down
48 changes: 30 additions & 18 deletions R/scales.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#'
#' @name scales_bde
#'
#' @param palette Name of the BdE palette to apply. One of `"bde_vivid_pal"`,
#' `"bde_rose_pal"`. See [bde_palettes()] for details.
#' @param palette Name of the BdE palette to apply. See [bde_tidy_palettes()]
#' for details.
#'
#' @inheritParams bde_palettes
#' @inheritParams bde_tidy_palettes
#'
#' @param ... Further arguments of [ggplot2::discrete_scale()] or
#' [ggplot2::continuous_scale()].
Expand All @@ -45,14 +45,15 @@
#'
#' ggplot(txsamp, aes(x = sales, y = median)) +
#' geom_point(aes(colour = city)) +
#' scale_color_bde_d("bde_rose_pal") +
#' scale_color_bde_d("bde_qual_pal") +
#' theme_minimal()
#'
scale_color_bde_d <- function(palette = c("bde_vivid_pal", "bde_rose_pal"),
alpha = NULL, rev = FALSE, ...) {
scale_color_bde_d <- function(
palette = c("bde_vivid_pal", "bde_rose_pal", "bde_qual_pal"), alpha = NULL,
rev = FALSE, ...) {
palette <- match.arg(palette)

cols_v <- bde_palettes(palette = palette, alpha = alpha, rev = rev)
cols_v <- bde_tidy_palettes(palette = palette, alpha = alpha, rev = rev)
pal <- scales::manual_pal(cols_v)

ggplot2::discrete_scale(
Expand All @@ -72,11 +73,12 @@ scale_colour_bde_d <- scale_color_bde_d
#' @rdname scales_bde
#' @name scales_bde
#' @export
scale_fill_bde_d <- function(palette = c("bde_vivid_pal", "bde_rose_pal"),
alpha = NULL, rev = FALSE, ...) {
scale_fill_bde_d <- function(
palette = c("bde_vivid_pal", "bde_rose_pal", "bde_qual_pal"), alpha = NULL,
rev = FALSE, ...) {
palette <- match.arg(palette)

cols_v <- bde_palettes(palette = palette, alpha = alpha, rev = rev)
cols_v <- bde_tidy_palettes(palette = palette, alpha = alpha, rev = rev)
pal <- scales::manual_pal(cols_v)

ggplot2::discrete_scale(
Expand All @@ -91,17 +93,22 @@ scale_fill_bde_d <- function(palette = c("bde_vivid_pal", "bde_rose_pal"),
#' @rdname scales_bde
#' @name scales_bde
#' @export
scale_color_bde_c <- function(palette = c("bde_rose_pal", "bde_vivid_pal"),
alpha = NULL, rev = FALSE, ...) {
scale_color_bde_c <- function(
palette = c("bde_rose_pal", "bde_vivid_pal", "bde_qual_pal"), alpha = NULL,
rev = FALSE, ...) {
palette <- match.arg(palette)


cols <- switch(palette,
"bde_vivid_pal" = bde_palettes(6, "bde_vivid_pal",
"bde_vivid_pal" = bde_tidy_palettes(6, "bde_vivid_pal",
alpha = alpha,
rev = rev
),
"bde_rose_pal" = bde_palettes(6, "bde_rose_pal",
"bde_qual_pal" = bde_tidy_palettes(6, "bde_qual_pal",
alpha = alpha,
rev = rev
),
"bde_rose_pal" = bde_tidy_palettes(6, "bde_rose_pal",
alpha = alpha,
rev = rev
)[c(1, 2, 3, 6, 5, 4)]
Expand All @@ -124,17 +131,22 @@ scale_colour_bde_c <- scale_color_bde_c
#' @rdname scales_bde
#' @name scales_bde
#' @export
scale_fill_bde_c <- function(palette = c("bde_rose_pal", "bde_vivid_pal"),
alpha = NULL, rev = FALSE, ...) {
scale_fill_bde_c <- function(
palette = c("bde_rose_pal", "bde_vivid_pal", "bde_qual_pal"), alpha = NULL,
rev = FALSE, ...) {
palette <- match.arg(palette)


cols <- switch(palette,
"bde_vivid_pal" = bde_palettes(6, "bde_vivid_pal",
"bde_vivid_pal" = bde_tidy_palettes(6, "bde_vivid_pal",
alpha = alpha,
rev = rev
),
"bde_qual_pal" = bde_tidy_palettes(6, "bde_qual_pal",
alpha = alpha,
rev = rev
),
"bde_rose_pal" = bde_palettes(6, "bde_rose_pal",
"bde_rose_pal" = bde_tidy_palettes(6, "bde_rose_pal",
alpha = alpha,
rev = rev
)[c(1, 2, 3, 6, 5, 4)]
Expand Down
4 changes: 2 additions & 2 deletions R/series.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#'
#'
#' @return
#' A [tibble][tibble::tibble] with a field "Date" and :
#' A [tibble][tibble::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,
Expand Down Expand Up @@ -291,7 +291,7 @@ bde_series_load <- function(series_code, series_label = NULL,
#' @param extract_metadata Logical `TRUE/FALSE`. On `TRUE` the output is the
#' metadata of the requested series.
#'
#' @return A [tibble][tibble::tibble] with a field "Date" and the alias of the
#' @return A [tibble][tibble::tibble] with a field `Date` and the alias of the
#' fields series as described on the catalogs. See [bde_catalog_load()].
#'
#' @note
Expand Down
7 changes: 4 additions & 3 deletions R/superseded.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
#' @description
#' `r lifecycle::badge('superseded')`
#'
#' These functions have been superseded, see [bde_palettes()] as a replacement.
#' These functions have been superseded, see [bde_tidy_palettes()] as a
#' replacement.
#'
#' Custom palettes based on the publications of BdE.
#'
Expand All @@ -29,7 +30,7 @@ bde_vivid_pal <- function(...) {
if (requireNamespace("lifecycle", quietly = TRUE)) {
lifecycle::deprecate_soft(
"0.3.5", "bde_vivid_pal()",
"bde_palettes()"
"bde_tidy_palettes()"
)
}

Expand All @@ -44,7 +45,7 @@ bde_rose_pal <- function(...) {
if (requireNamespace("lifecycle", quietly = TRUE)) {
lifecycle::deprecate_soft(
"0.3.5", "bde_rose_pal()",
"bde_palettes()"
"bde_tidy_palettes()"
)
}
pal <- c("#b7365c", "#cb6e8a", "#db9aad", "#0a50a1", "#5385bd", "#89AEDA")
Expand Down
2 changes: 1 addition & 1 deletion R/theme_tidybde.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#' names(series_TC_pivot) <- c("x", "y")
#'
#' ggplot(series_TC_pivot, aes(x = x, y = y)) +
#' geom_line(linewidth = 0.8, color = bde_palettes(n = 1)) +
#' geom_line(linewidth = 0.8, color = bde_tidy_palettes(n = 1)) +
#' labs(
#' title = "Title",
#' subtitle = "Some metric",
Expand Down
4 changes: 2 additions & 2 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ BdE:

```{r chart, fig.asp=0.7}
ggplot(time_series, aes(x = Date, y = EUR_GBP_XR)) +
geom_line(colour = bde_palettes(n = 1)) +
geom_smooth(method = "gam", colour = bde_palettes(n = 2)[2]) +
geom_line(colour = bde_tidy_palettes(n = 1)) +
geom_smooth(method = "gam", colour = bde_tidy_palettes(n = 2)[2]) +
labs(
title = "EUR/GBP Exchange Rate (2010-2020)",
subtitle = "%",
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,8 @@ publications of BdE:

``` r
ggplot(time_series, aes(x = Date, y = EUR_GBP_XR)) +
geom_line(colour = bde_palettes(n = 1)) +
geom_smooth(method = "gam", colour = bde_palettes(n = 2)[2]) +
geom_line(colour = bde_tidy_palettes(n = 1)) +
geom_smooth(method = "gam", colour = bde_tidy_palettes(n = 2)[2]) +
labs(
title = "EUR/GBP Exchange Rate (2010-2020)",
subtitle = "%",
Expand Down Expand Up @@ -231,7 +231,7 @@ A BibTeX entry for LaTeX users is
doi = {10.5281/zenodo.4673496},
author = {Diego {H. Herrero}},
year = {2024},
version = {0.3.4.9000},
version = {0.3.5},
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.},
}
6 changes: 3 additions & 3 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
"codeRepository": "https://github.com/rOpenSpain/tidyBdE",
"issueTracker": "https://github.com/rOpenSpain/tidyBdE/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.3.4.9000",
"version": "0.3.5",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.3.2 (2023-10-31 ucrt)",
"runtimePlatform": "R version 4.3.2 (2023-10-31)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand Down Expand Up @@ -192,7 +192,7 @@
},
"applicationCategory": "Macroeconomics",
"isPartOf": "https://ropenspain.es/",
"fileSize": "273.717KB",
"fileSize": "273.083KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
4 changes: 2 additions & 2 deletions inst/schemaorg.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"runtimePlatform": "R version 4.3.2 (2023-10-31 ucrt)",
"version": "0.3.4.9000"
"runtimePlatform": "R version 4.3.2 (2023-10-31)",
"version": "0.3.5"
},
{
"id": "https://doi.org/10.5281/zenodo.4673496",
Expand Down
3 changes: 2 additions & 1 deletion man/bde_pals.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 86401c6

Please sign in to comment.