Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Apr 1, 2024
1 parent 319c859 commit c01e6bd
Show file tree
Hide file tree
Showing 19 changed files with 85 additions and 69 deletions.
24 changes: 6 additions & 18 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tidyBdE (development version)

- Adapt `scale_color_bde_d()` and friends to **ggplot2** 3.5.0. Also
expose the `guide` argument instead of hard-coding it.
- Adapt `scale_color_bde_d()` and friends to **ggplot2** 3.5.0. Also expose
the `guide` argument instead of hard-coding it.

# tidyBdE 0.3.5

Expand All @@ -25,37 +25,28 @@ Mostly changes on the color functions:
# tidyBdE 0.3.2

- Remove **tidyverse** from Suggests.

- On indicators:

- `bde_ind_ibex()` renamed to `bde_ind_ibex_monthly()`.
- New indicator `bde_ind_ibex_daily()`

# tidyBdE 0.3.1

- Add new dependency: **tidyr**.

- New parameter `out_format` on `bde_series_load()`.

- Use best practices and small adjustments on `theme_tidybde()`.

# tidyBdE 0.3.0

- Overall improvements on downloading files:

- On url not reachable, remove the local csv since it is empty.

- Improve download process.

- More informative messages for the final user.

- Internal performance improvements.

- **Breaking change**: `theme_bde()` renamed to `theme_tidybde()`.

# tidyBdE 0.2.5

- Update HTML5 due to CRAN request
- Update HTML5 due to **CRAN** request

# tidyBdE 0.2.4

Expand All @@ -65,7 +56,6 @@ Mostly changes on the color functions:

- The followings catalogs has been deprecated on the API, package updated
accordingly:

- **CF**: Financial Accounts of the Spanish Economy.
- **IE**: Economic Indicators

Expand All @@ -76,9 +66,7 @@ Mostly changes on the color functions:
[here](https://www.bde.es/wbe/en/estadisticas/)). Some series on
`bde_indicators()` are likely to be broken in the meantime. So far, these
series has been updated:

- `bde_ind_euribor_12m_monthly()`: New series code is `587853`.

- Update docs and examples.

# tidyBdE 0.2.1
Expand All @@ -93,7 +81,7 @@ Mostly changes on the color functions:
- Add series index article.
- Add new series: `bde_ind_gdp_quarterly()`, `bde_ind_population()`.
- Improve package coverage and docs.
- Move tests to `testthat`.
- Move tests to **testthat**.
- The following scales have been removed: `bde_scale_colour_vivid()`,
`bde_scale_color_vivid()`, `bde_scale_fill_vivid()`,
`bde_scale_colour_rose()`, `bde_scale_color_rose()` `bde_scale_fill_rose()`.
Expand All @@ -102,7 +90,7 @@ Mostly changes on the color functions:
# tidyBdE 0.1.2

- Precompile vignette.
- Better handling of errors, according to CRAN rules.
- Better handling of errors, according to **CRAN** rules.
- Changed some examples.

# tidyBdE 0.1.1
Expand All @@ -111,7 +99,7 @@ Mostly changes on the color functions:
- Color adjustment on `bde_rose_pal()`: Now hcl spectrum is more consistent
between roses and blues according to `colorspace::specplot()`.
- Add DOI: <https://doi.org/10.5281/zenodo.4673496>
- New palettes for `ggplot2`: `scale_color_bde_c()`, `scale_color_bde_d()`,
- New palettes for **ggplot2**: `scale_color_bde_c()`, `scale_color_bde_d()`,
`scale_fill_bde_c()`, `scale_fill_bde_d()`.
- Deprecated scales: `bde_scale_colour_vivid()`, `bde_scale_color_vivid()`,
`bde_scale_fill_vivid()`, `bde_scale_colour_rose()`,
Expand Down
42 changes: 28 additions & 14 deletions R/catalogs.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,15 @@
#' @return A [`tibble`][tibble::tibble] object.
#'
#' @source
#' [Time-series bulk data
#' download](https://www.bde.es/webbe/en/estadisticas/recursos/descargas-completas.html)
#'
#' ```{r, echo=FALSE, results='asis'}
#'
#' cat(paste0("[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**.
Expand All @@ -33,11 +40,11 @@
#'
#' t <- tibble::tribble(
#' ~CODE, ~PUBLICATION, ~UPDATEFREQUENCY, ~FREQUENCY,
#' "**BE**", "Statistical Bulletin", "Daily", "Monthly",
#' "**SI**", "Summary Indicators", "Daily", "Daily",
#' "**TC**", "Exchange Rates", "Daily", "Daily",
#' "**TI**", "Interest Rates", "Daily", "Daily",
#' "**PB**", "Bank Lending Survey", "Quarterly", "Quarterly",
#' '`"BE"`', "Statistical Bulletin", "Daily", "Monthly",
#' '`"SI"`', "Summary Indicators", "Daily", "Daily",
#' '`"TC"`', "Exchange Rates", "Daily", "Daily",
#' '`"TI"`', "Interest Rates", "Daily", "Daily",
#' '`"PB"`', "Bank Lending Survey", "Quarterly", "Quarterly",
#' )
#'
#' names(t) <- paste0("**",
Expand Down Expand Up @@ -194,8 +201,15 @@ bde_catalog_load <- function(catalog = c("ALL", "BE", "SI", "TC", "TI", "PB"),
#' @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)
#'
#' ```{r, echo=FALSE, results='asis'}
#'
#' cat(paste0("[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**.
Expand All @@ -211,11 +225,11 @@ bde_catalog_load <- function(catalog = c("ALL", "BE", "SI", "TC", "TI", "PB"),
#'
#' t <- tibble::tribble(
#' ~CODE, ~PUBLICATION, ~UPDATEFREQUENCY, ~FREQUENCY,
#' "**BE**", "Statistical Bulletin", "Daily", "Monthly",
#' "**SI**", "Summary Indicators", "Daily", "Daily",
#' "**TC**", "Exchange Rates", "Daily", "Daily",
#' "**TI**", "Interest Rates", "Daily", "Daily",
#' "**PB**", "Bank Lending Survey", "Quarterly", "Quarterly",
#' '`"BE"`', "Statistical Bulletin", "Daily", "Monthly",
#' '`"SI"`', "Summary Indicators", "Daily", "Daily",
#' '`"TC"`', "Exchange Rates", "Daily", "Daily",
#' '`"TI"`', "Interest Rates", "Daily", "Daily",
#' '`"PB"`', "Bank Lending Survey", "Quarterly", "Quarterly",
#' )
#'
#' names(t) <- paste0("**",
Expand Down
2 changes: 1 addition & 1 deletion R/indicators.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#'
#' @inheritDotParams bde_series_load -series_code
#'
#' @return A `tibble` with the required series.
#' @return A [`tibble`][tibble::tibble] with the required series.
#'
#' @seealso [bde_series_load()], [bde_catalog_search()]
#'
Expand Down
9 changes: 5 additions & 4 deletions R/series.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@
#' 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,
#' - With `out_format = "long"` the `tibble` would have two more columns,
#' `serie_name` with the labels of each series and `serie_value` with the
#' value of the series.
#'
#' "wide" format is more suitable for exporting to a `.csv` file while "long"
#' format is more suitable for producing plots with [ggplot2::ggplot()].
#' See also [tidyr::pivot_longer()] and [tidyr::pivot_wider()].
#' `"wide"` format is more suitable for exporting to a `.csv` file while
#' `"long"` format is more suitable for producing plots with
#' [ggplot2::ggplot()]. See also [tidyr::pivot_longer()] and
#' [tidyr::pivot_wider()].
#'
#' @description
#'
Expand Down
9 changes: 5 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.re

**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 provided as [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

Expand Down Expand Up @@ -121,8 +122,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 chart, fig.asp=0.7}
ggplot(time_series, aes(x = Date, y = EUR_GBP_XR)) +
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.3.3 (2024-02-29 ucrt)",
"runtimePlatform": "R version 4.3.3 (2024-02-29)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand Down Expand Up @@ -192,7 +192,7 @@
},
"applicationCategory": "Macroeconomics",
"isPartOf": "https://ropenspain.es/",
"fileSize": "289.095KB",
"fileSize": "285.104KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
2 changes: 2 additions & 0 deletions inst/WORDLIST
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ diarios
electrónica
esterlinas
geospatial
ggplot
halfyear
hcl
mapSpain
Expand All @@ -50,6 +51,7 @@ rOS
rect
secuencial
serie
testthat
tibble
tidyr
tidyverse
2 changes: 1 addition & 1 deletion inst/schemaorg.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"runtimePlatform": "R version 4.3.3 (2024-02-29 ucrt)",
"runtimePlatform": "R version 4.3.3 (2024-02-29)",
"version": "0.3.5.9000"
},
{
Expand Down
12 changes: 6 additions & 6 deletions man/bde_catalog_load.Rd

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

12 changes: 6 additions & 6 deletions man/bde_catalog_update.Rd

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

2 changes: 1 addition & 1 deletion man/bde_indicators.Rd

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

9 changes: 5 additions & 4 deletions man/bde_series_load.Rd

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

Binary file modified man/figures/README-chart-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ reference:
- has_concept("indicators")

- title: "Plot utils"
desc: Complementary functions for plotting with `ggplot2`.
desc: >
Complementary functions for plotting with
<a href="https://CRAN.R-project.org/package=ggplot2"
class="external-link"><span class="pkg">ggplot2</span></a>.
contents:
- has_concept("bde_plot")

Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-series.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,5 @@ test_that("Series full", {
options(bde_test_offline = FALSE)

failfix <- bde_series_full_load(all_names[2], cache_dir = dir)
expect_true(is.null(failfix))
expect_gt(nrow(failfix), 10)
})
9 changes: 7 additions & 2 deletions vignettes/articles/Series_Index.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ series_clean <- series %>%
filter(!is.na(Numero_secuencial)) %>%
select(
Numero_secuencial, Descripcion_de_la_serie,
Titulo_de_la_serie,
Fecha_de_la_ultima_observacion
Titulo_de_la_serie, Fuente, Fecha_de_la_primera_observacion,
Fecha_de_la_ultima_observacion, Frecuencia_de_la_serie,
Tipo_de_variable, Codigo_de_unidades
)
Expand All @@ -58,6 +59,10 @@ reactable(series_clean,
searchable = TRUE,
showPageSizeOptions = TRUE,
striped = TRUE,
defaultColDef = colDef(
minWidth = 150, html = TRUE,
align = "left", vAlign = "center"
),
paginationType = "jump",
defaultPageSize = 5,
compact = TRUE,
Expand Down
Binary file modified vignettes/chart-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/macroseries-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c01e6bd

Please sign in to comment.