Skip to content

Commit

Permalink
findings from CRAN winbuilder service / relates #3
Browse files Browse the repository at this point in the history
  • Loading branch information
jlacko committed Sep 8, 2023
1 parent c500bef commit 52d2c6a
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 44 deletions.
3 changes: 1 addition & 2 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@
^codecov\.yml$
^CITATION\.cff$
^generate-vignette.R$
vignettes\vignette.Rmd.orig
vignettes\figure\*
^vignette.Rmd.orig$
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions R/cnbfxrate.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
8 changes: 4 additions & 4 deletions R/pribor.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<!-- badges: start -->

[![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)
Expand Down
24 changes: 14 additions & 10 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
3 changes: 2 additions & 1 deletion generate-vignette.R
Original file line number Diff line number Diff line change
Expand Up @@ -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/")

8 changes: 4 additions & 4 deletions vignettes/vignette.Rmd.orig → vignette.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() +
Expand Down Expand Up @@ -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() +
Expand Down Expand Up @@ -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",
Expand Down
38 changes: 19 additions & 19 deletions vignettes/vignette.Rmd
Original file line number Diff line number Diff line change
@@ -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}
Expand Down Expand Up @@ -34,7 +34,7 @@ pribor()
## # A tibble: 1 × 2
## date_valid PRIBOR_1D
## <date> <dbl>
## 1 2023-09-06 0.07
## 1 2023-09-07 0.07

# PRIBOR: specific date, default tenor
pribor(as.Date("2020-05-20"))
Expand Down Expand Up @@ -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() +
Expand All @@ -87,7 +87,7 @@ ggplot(data = offered_rate, aes(x = date_valid, y = PRIBOR_1D)) +
```

<div class="figure" style="text-align: center">
<img src="./vignettes/asian-fever-1.png" alt="plot of chunk asian-fever" width="100%" />
<img src="./asian-fever-1.png" alt="plot of chunk asian-fever" width="100%" />
<p class="caption">plot of chunk asian-fever</p>
</div>

Expand All @@ -106,7 +106,7 @@ repo2w()
## # A tibble: 1 × 2
## date_valid REPO_2W
## <date> <dbl>
## 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)
Expand All @@ -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() +
Expand All @@ -141,7 +141,7 @@ ggplot(data = policy_rate, aes(x = date_valid, y = REPO_2W)) +
```

<div class="figure" style="text-align: center">
<img src="./vignettes/recent-development-ir-1.png" alt="plot of chunk recent-development-ir" width="100%" />
<img src="./recent-development-ir-1.png" alt="plot of chunk recent-development-ir" width="100%" />
<p class="caption">plot of chunk recent-development-ir</p>
</div>

Expand All @@ -168,16 +168,16 @@ cnbfxrate()
## # A tibble: 31 × 4
## date_valid currency_code amount rate
## <date> <chr> <dbl> <dbl>
## 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)
Expand Down Expand Up @@ -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",
Expand All @@ -217,6 +217,6 @@ ggplot(data = euro_rate, aes(x = date_valid, y = rate)) +
```

<div class="figure" style="text-align: center">
<img src="./vignettes/recent-development-fx-1.png" alt="plot of chunk recent-development-fx" width="100%" />
<img src="./recent-development-fx-1.png" alt="plot of chunk recent-development-fx" width="100%" />
<p class="caption">plot of chunk recent-development-fx</p>
</div>

0 comments on commit 52d2c6a

Please sign in to comment.