From 6080fec6250191b91b138b6accbbcfb73a4c7586 Mon Sep 17 00:00:00 2001 From: Corentin Lemasson <95612140+clemasso@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:54:23 +0200 Subject: [PATCH 1/2] Update README.md --- README.md | 80 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 60 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 8cc5ba9..f7cc059 100644 --- a/README.md +++ b/README.md @@ -26,27 +26,49 @@ remotes::install_github("rjdemetra/rjd3revisions", build_vignettes = TRUE) ## Usage First you need to get your input data set as a data.frame in R in a -specific format as below. - -| rev_date | time_period | obs_values | -|------------|-------------|------------| -| 2022-07-31 | 2022Q1 | 0.8 | -| 2022-07-31 | 2022Q2 | 0.2 | -| 2022-07-31 | 2022Q3 | NA | -| 2022-07-31 | 2022Q4 | NA | -| 2022-08-31 | 2022Q1 | 0.8 | -| … | … | … | +specific format as below. Note that missing values can either be mentioned as NA +(as in the example below) or not be included in the input at the best convenience of +the user. + +### Format 1: long view + +| rev_date | time_period | obs_values | +| ----------- | ----------- | ----------- | +| 2022-07-31 | 2022Q1 | 0.8 | +| 2022-07-31 | 2022Q2 | 0.2 | +| 2022-07-31 | 2022Q3 | NA | +| 2022-07-31 | 2022Q4 | NA | +| 2022-08-31 | 2022Q1 | 0.8 | +| ... | ... | ... | + +### Format 2: vertical view + +| Period | 2023/03/31 | 2023/04/30 | 2023/05/31 | +| -------- | ---------- | ---------- | ---------- | +| 2022M01 | 15.2 | 15.1 | 15.0 | +| 2022M02 | 15.0 | 14.9 | 14.9 | +| ... | ... | ... | ... | +| 2023M01 | 13.0 | 13.1 | 13.2 | +| 2023M02 | | 12.1 | 12.1 | +| 2023M03 | | | 12.3 | + +### Format 3: horizontal view + +| Period | 2022M01 | 2022M02 | ... | 2023M01 | 2023M02 | 2023M03 | +| ---------- | ------- | ------- | ------- | ------- | ------- | ------- | +| 2023/03/31 | 15.2 | 15.0 | ... | 13.0 | | | +| 2023/04/30 | 15.1 | 14.9 | ... | 13.1 | 12.1 | | +| 2023/05/31 | 15.0 | 14.9 | ... | 13.2 | 12.1 | 12.3 | ``` r -# Example -df <- data.frame( - rev_date = c( - rep("2022-07-31", 4), rep("2022-08-31", 4), - rep("2022-09-30", 4), rep("2022-10-31", 4), - rep("2022-11-30", 4), rep("2022-12-31", 4), - rep("2023-01-31", 4), rep("2023-02-28", 4) - ), - time_period = c(rep(c("2022Q1", "2022Q2", "2022Q3", "2022Q4"), 8)), +# Examples + +# Long format +long_view <- data.frame( + rev_date = rep(x = c("2022-07-31", "2022-08-31", "2022-09-30", "2022-10-31", + "2022-11-30", "2022-12-31", "2023-01-31", "2023-02-28"), + each = 4L), + time_period = rep(x = c("2022Q1", "2022Q2", "2022Q3", "2022Q4"), times = 8L), obs_values = c( .8, .2, NA, NA, .8, .1, NA, NA, .7, .1, NA, NA, .7, .2, .5, NA, @@ -54,6 +76,24 @@ df <- data.frame( .7, .2, .7, .4, .7, .3, .7, .3 ) ) + +# Horizontal format +horizontal_view <- matrix(data = c(.8, .8, .7, .7, .7, .7, .7, .7, .2, .1, + .1, .2, .2, .3, .2, .3, NA, NA, NA, .5, .5, .7, .7, + .7, NA, NA, NA, NA, NA, NA, .4, .3), + ncol = 4) +colnames(horizontal_view) <- c("2022Q1", "2022Q2", "2022Q3", "2022Q4") +rownames(horizontal_view) <- c("2022-07-31", "2022-08-31", "2022-09-30", "2022-10-31", + "2022-11-30", "2022-12-31", "2023-01-31", "2023-02-28") + +# Vertical format +vertical_view <- matrix(data = c(.8, .2, NA, NA, .8, .1, NA, NA, .7, .1, NA, + NA, .7, .2, .5, NA, .7, .2, .5, NA, .7, .3, .7, NA, + .7, .2, .7, .4, .7, .3, .7, .3), + nrow = 4) +rownames(vertical_view) <- c("2022Q1", "2022Q2", "2022Q3", "2022Q4") +colnames(vertical_view) <- c("2022-07-31", "2022-08-31", "2022-09-30", "2022-10-31", + "2022-11-30", "2022-12-31", "2023-01-31", "2023-02-28") ``` Then you can create your vintages, inspect revisions if you want and @@ -64,6 +104,7 @@ library("rjd3revisions") vintages <- create_vintages(df, periodicity = 4) # revisions<-get_revisions(vintages, gap = 2) +# plot(revisions) rslt <- revision_analysis(vintages, gap = 1, view = "diagonal", n.releases = 3) ``` @@ -74,7 +115,6 @@ render_report(rslt) summary(rslt) print(rslt) -plot(rslt) ``` ## Additional information From 7c44da0eb1947f1b1d9501ec79b8d71d8b432082 Mon Sep 17 00:00:00 2001 From: Corentin Lemasson <95612140+clemasso@users.noreply.github.com> Date: Mon, 22 Apr 2024 14:56:24 +0200 Subject: [PATCH 2/2] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f7cc059..d4f3776 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,9 @@ ## Installation +Running rjd3 packages requires Java 17 or higher. How to set up such a configuration +in R is explained [here](https://jdemetra-new-documentation.netlify.app/#installing-the-software) + To get the current stable version (from the latest release): ``` r @@ -96,7 +99,7 @@ colnames(vertical_view) <- c("2022-07-31", "2022-08-31", "2022-09-30", "2022-10- "2022-11-30", "2022-12-31", "2023-01-31", "2023-02-28") ``` -Then you can create your vintages, inspect revisions if you want and +Then you can create your vintages, inspect revisions (optional) and make the analysis ``` r