From 52d2c6a54b3930992d94143868de567e5bb10d47 Mon Sep 17 00:00:00 2001 From: Jindra Lacko Date: Fri, 8 Sep 2023 08:32:28 +0200 Subject: [PATCH] findings from CRAN winbuilder service / relates #3 --- .Rbuildignore | 3 +- DESCRIPTION | 2 +- R/cnbfxrate.R | 5 ++- R/pribor.R | 8 ++-- README.md | 2 +- cran-comments.md | 24 +++++++----- generate-vignette.R | 3 +- .../vignette.Rmd.orig => vignette.Rmd.orig | 8 ++-- vignettes/vignette.Rmd | 38 +++++++++---------- 9 files changed, 49 insertions(+), 44 deletions(-) rename vignettes/vignette.Rmd.orig => vignette.Rmd.orig (97%) diff --git a/.Rbuildignore b/.Rbuildignore index d43d5b5..9bd40b8 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -11,5 +11,4 @@ ^codecov\.yml$ ^CITATION\.cff$ ^generate-vignette.R$ -vignettes\vignette.Rmd.orig -vignettes\figure\* +^vignette.Rmd.orig$ diff --git a/DESCRIPTION b/DESCRIPTION index 3ce249a..4ec271e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,7 +3,7 @@ Type: Package Title: Czech Interest & Foreign Exchange Rates Version: 0.2.4 Date: - 2024-09-09 + 2023-09-09 Authors@R: c( person(given = "Jindra", family = "Lacko", diff --git a/R/cnbfxrate.R b/R/cnbfxrate.R index 6ca7bd0..e06a2d1 100644 --- a/R/cnbfxrate.R +++ b/R/cnbfxrate.R @@ -20,13 +20,14 @@ cnbfxrate <- function(date = Sys.Date() - 1, cnb <- as.logical(Sys.getenv("CNB_UP", unset = TRUE)) # dummy variable to allow testing of network + # a quick reality check: + if(!inherits(date, "Date")) stop("'date' parameter expected as a Date data type!") + if (!ok_to_proceed("https://www.cnb.cz/cs/financni-trhy/devizovy-trh/kurzy-devizoveho-trhu/kurzy-devizoveho-trhu/") | !cnb) { # CNB website down message("Data source broken.") return(NULL) } - # a quick reality check: - if(!inherits(date, "Date")) stop("'date' parameter expected as a Date data type!") roky <- format(date, "%Y") %>% unique() diff --git a/R/pribor.R b/R/pribor.R index d164a23..7db7ec6 100644 --- a/R/pribor.R +++ b/R/pribor.R @@ -28,15 +28,15 @@ pribor <- function(date = Sys.Date() - 1, maturity = "1D") { cnb <- as.logical(Sys.getenv("CNB_UP", unset = TRUE)) # dummy variable to allow testing of network + # a quick reality check: + if(!inherits(date, "Date")) stop("'date' parameter expected as a Date data type!") + if(!all(maturity %in% c("1D", "1W", "2W", "1M", "3M", "6M", "9M", "1Y"))) stop(paste0("'", maturity, "' is not a recognized maturity abbreviation!")) + if (!ok_to_proceed("https://www.cnb.cz/en/financial-markets/money-market/pribor/fixing-of-interest-rates-on-interbank-deposits-pribor/year.txt") | !cnb) { # CNB website down message("Data source broken.") return(NULL) } - # a quick reality check: - if(!inherits(date, "Date")) stop("'date' parameter expected as a Date data type!") - if(!all(maturity %in% c("1D", "1W", "2W", "1M", "3M", "6M", "9M", "1Y"))) stop(paste0("'", maturity, "' is not a recognized maturity abbreviation!")) - roky <- format(date, "%Y") %>% unique() diff --git a/README.md b/README.md index 89438d8..f95e74a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![R-CMD-check](https://github.com/jla-data/czechrates/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/jla-data/czechrates/actions/workflows/R-CMD-check.yaml) -[![Codecov test coverage](https://codecov.io/gh/jla-data/czechrates/branch/master/graph/badge.svg)](https://codecov.io/gh/jla-data/czechrates?branch=master) [![CRAN](http://www.r-pkg.org/badges/version/czechrates)](https://cran.r-project.org/package=czechrates) +[![Codecov test coverage](https://codecov.io/gh/jla-data/czechrates/branch/master/graph/badge.svg)](https://app.codecov.io/gh/jla-data/czechrates?branch=master) [![CRAN](http://www.r-pkg.org/badges/version/czechrates)](https://cran.r-project.org/package=czechrates) [![CRAN-checks](https://badges.cranchecks.info/worst/czechrates.svg)](https://cran.r-project.org/web/checks/check_results_czechrates.html) [![Downloads-total](http://cranlogs.r-pkg.org/badges/grand-total/czechrates?color=brightgreen)](https://www.r-pkg.org:443/pkg/czechrates) [![Downloads-weekly](http://cranlogs.r-pkg.org/badges/last-week/czechrates?color=brightgreen)](https://www.r-pkg.org:443/pkg/czechrates) diff --git a/cran-comments.md b/cran-comments.md index f4c5eb8..e8574ee 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,13 +1,15 @@ ## Test environments -* ubuntu 20.04.2 LTS, 4.1.0 (2021-05-18) (local) -* Windows R version 4.1.0 (2021-05-18)(win-builder) -* Windows R version 4.0.5 (2021-03-31)(win-builder) -* Windows R Under development (unstable) (2021-05-18 r80323) (win-builder) -* Microsoft Windows Server 2019, R version 4.1.0 (2021-05-18) (GitHub Actions) -* Mac OS X, R version 4.1.0 (2021-05-18) (GitHub Actions) -* ubuntu 20.04.2 LTS, R version 4.1.0 (2021-05-18) (GitHub Actions) -* ubuntu 20.04.2 LTS, R Under development (unstable) (2021-05-24 r80372) (GitHub Actions) -* Debian Linux, R-devel, clang, ISO-8859-15 locale (rhub) +* Ubuntu 22.04.3 LTS, R version 4.3.1 (2023-06-16) (local) + +* Windows R version 4.3.1 (2023-06-16 ucrt) (win-builder) +* Windows R version 4.2.3 (2023-03-15 ucrt) (win-builder) +* Windows R Under development (unstable) (2023-09-07 r85102 ucrt) (win-builder) + +* Microsoft Windows Server 2022 10.0.20348, R version 4.3.1 (2023-06-16 ucrt) (GitHub Actions) +* macOS 12.6.8 21G725, R version 4.3.1 (2023-06-16) (GitHub Actions) +* Ubuntu 22.04.3 LTS, R version 4.3.1 (2023-06-16) (GitHub Actions) +* Ubuntu 22.04.3 LTS, R Under development (unstable) (2023-09-06 r85088) (GitHub Actions) +* Ubuntu 22.04.3 LTS, R version 4.2.3 (2023-03-15) (GitHub Actions) ## R CMD check results Status: OK @@ -16,4 +18,6 @@ Status: OK There are no downstream dependencies. ## CRAN checks -This submission eliminates the encoding issue identified for v0.2.0 on strict LATIN-1 build (debian-clang) +This submission resolves the error thrown for version 0.2.2 CRAN machines, triggered by an internet resource / connectivity failure. + +Since the one and only purpose of the package is API wrapping the test set and package vignette were amended in order to enhance compliance with the standing policy of a graceful fail in case of internet resource failure. diff --git a/generate-vignette.R b/generate-vignette.R index 35522be..1e254a8 100644 --- a/generate-vignette.R +++ b/generate-vignette.R @@ -3,6 +3,7 @@ library(knitr) system("rm ./vignettes/vignette.Rmd") system("rm -rf ./vignettes/*.png") -knit("./vignettes/vignette.Rmd.orig", +knit("./vignette.Rmd.orig", output = "./vignettes/vignette.Rmd") +system("mv ./*.png ./vignettes/") diff --git a/vignettes/vignette.Rmd.orig b/vignette.Rmd.orig similarity index 97% rename from vignettes/vignette.Rmd.orig rename to vignette.Rmd.orig index 5636427..3c859f5 100644 --- a/vignettes/vignette.Rmd.orig +++ b/vignette.Rmd.orig @@ -16,7 +16,7 @@ knitr::opts_chunk$set(collapse = T, out.width = "100%", fig.width = 8, fig.height = 4, - fig.path = "./vignettes/") + fig.path = "./") ``` ## PRIBOR - PRague InterBank Offered Rate @@ -66,7 +66,7 @@ offered_rate <- pribor(seq(from = as.Date("1997-05-01"), by = 1)) ggplot(data = offered_rate, aes(x = date_valid, y = PRIBOR_1D)) + - geom_line(color = "red", size = 1.25) + + geom_line(color = "red", linewidth = 1.25) + scale_x_date(date_labels = "%d.%m.%Y") + scale_y_continuous(labels = percent_format()) + theme_bw() + @@ -105,7 +105,7 @@ policy_rate <- repo2w(seq(from = as.Date("2020-01-01"), by = 1)) ggplot(data = policy_rate, aes(x = date_valid, y = REPO_2W)) + - geom_line(color = "red", size = 1.25) + + geom_line(color = "red", linewidth = 1.25) + scale_x_date(date_labels = "%d.%m.%Y") + scale_y_continuous(labels = percent_format()) + theme_bw() + @@ -154,7 +154,7 @@ euro_rate <- cnbfxrate(seq(from = as.Date("2020-01-01"), "EUR") ggplot(data = euro_rate, aes(x = date_valid, y = rate)) + - geom_line(color = "red", size = 1.25) + + geom_line(color = "red", linewidth = 1.25) + scale_x_date(date_labels = "%d.%m.%Y") + scale_y_continuous(labels = dollar_format(prefix = "", suffix = " CZK", diff --git a/vignettes/vignette.Rmd b/vignettes/vignette.Rmd index e058cd0..d27ba8d 100644 --- a/vignettes/vignette.Rmd +++ b/vignettes/vignette.Rmd @@ -1,7 +1,7 @@ --- title: "CZK Reference Rates" author: "Jindra Lacko" -date: "2023-09-07" +date: "2023-09-08" output: rmarkdown::html_vignette vignette: > %\VignetteIndexEntry{CZK_Reference_Rates} @@ -34,7 +34,7 @@ pribor() ## # A tibble: 1 × 2 ## date_valid PRIBOR_1D ## -## 1 2023-09-06 0.07 +## 1 2023-09-07 0.07 # PRIBOR: specific date, default tenor pribor(as.Date("2020-05-20")) @@ -77,7 +77,7 @@ offered_rate <- pribor(seq(from = as.Date("1997-05-01"), by = 1)) ggplot(data = offered_rate, aes(x = date_valid, y = PRIBOR_1D)) + - geom_line(color = "red", size = 1.25) + + geom_line(color = "red", linewidth = 1.25) + scale_x_date(date_labels = "%d.%m.%Y") + scale_y_continuous(labels = percent_format()) + theme_bw() + @@ -87,7 +87,7 @@ ggplot(data = offered_rate, aes(x = date_valid, y = PRIBOR_1D)) + ```
-plot of chunk asian-fever +plot of chunk asian-fever

plot of chunk asian-fever

@@ -106,7 +106,7 @@ repo2w() ## # A tibble: 1 × 2 ## date_valid REPO_2W ## -## 1 2023-09-06 0.07 +## 1 2023-09-07 0.07 # two-week REPO rate for three specific dates (as defined in the PRIBOR section) repo2w(three_dates) @@ -131,7 +131,7 @@ policy_rate <- repo2w(seq(from = as.Date("2020-01-01"), by = 1)) ggplot(data = policy_rate, aes(x = date_valid, y = REPO_2W)) + - geom_line(color = "red", size = 1.25) + + geom_line(color = "red", linewidth = 1.25) + scale_x_date(date_labels = "%d.%m.%Y") + scale_y_continuous(labels = percent_format()) + theme_bw() + @@ -141,7 +141,7 @@ ggplot(data = policy_rate, aes(x = date_valid, y = REPO_2W)) + ```
-plot of chunk recent-development-ir +plot of chunk recent-development-ir

plot of chunk recent-development-ir

@@ -168,16 +168,16 @@ cnbfxrate() ## # A tibble: 31 × 4 ## date_valid currency_code amount rate ## -## 1 2023-09-06 AUD 1 14.4 -## 2 2023-09-06 BGN 1 12.4 -## 3 2023-09-06 BRL 1 4.53 -## 4 2023-09-06 CAD 1 16.5 -## 5 2023-09-06 CHF 1 25.3 -## 6 2023-09-06 CNY 1 3.09 -## 7 2023-09-06 DKK 1 3.25 -## 8 2023-09-06 EUR 1 24.2 -## 9 2023-09-06 GBP 1 28.3 -## 10 2023-09-06 HKD 1 2.88 +## 1 2023-09-07 AUD 1 14.5 +## 2 2023-09-07 BGN 1 12.5 +## 3 2023-09-07 BRL 1 4.57 +## 4 2023-09-07 CAD 1 16.7 +## 5 2023-09-07 CHF 1 25.5 +## 6 2023-09-07 CNY 1 3.11 +## 7 2023-09-07 DKK 1 3.27 +## 8 2023-09-07 EUR 1 24.4 +## 9 2023-09-07 GBP 1 28.4 +## 10 2023-09-07 HKD 1 2.90 ## # ℹ 21 more rows # EUR/CZK rate for three specific dates (as defined in the PRIBOR section) @@ -205,7 +205,7 @@ euro_rate <- cnbfxrate(seq(from = as.Date("2020-01-01"), "EUR") ggplot(data = euro_rate, aes(x = date_valid, y = rate)) + - geom_line(color = "red", size = 1.25) + + geom_line(color = "red", linewidth = 1.25) + scale_x_date(date_labels = "%d.%m.%Y") + scale_y_continuous(labels = dollar_format(prefix = "", suffix = " CZK", @@ -217,6 +217,6 @@ ggplot(data = euro_rate, aes(x = date_valid, y = rate)) + ```
-plot of chunk recent-development-fx +plot of chunk recent-development-fx

plot of chunk recent-development-fx