Skip to content

Commit

Permalink
Merge pull request #54 from clemasso/develop
Browse files Browse the repository at this point in the history
fix display glitch in vintage and revision print functions
  • Loading branch information
clemasso authored Aug 21, 2024
2 parents 0db99ce + 75186ef commit c9f54ec
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 10 deletions.
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* pivot from {formattable} dependency to {flextable} to build the tables
* `simulate_long()` is now an exported function to construct datasets example

### Fixed

* solve a display glitch in functions print.rjd3rev_vintages() and print.rjd3rev_revisions()


## [1.3.2] - 2024-07-10

Expand Down
7 changes: 4 additions & 3 deletions R/revision_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
#'
#' ## Call using all default parameters
#' rslt1 <- revision_analysis(vintages)
#' # render_report(rslt1)
#' # render_report(rslt1, output_file = "report1", output_dir = "C:/Users/xxx")
#' summary(rslt1) # formatted summary only
#' View(rslt1) # formatted tables in viewer panel
#'
Expand All @@ -82,7 +82,8 @@
#' ## performed automatically (if transf.diff is let to its default option) but `transf.log`
#' ## must be set to TRUE manually whenever a log-transformation of the data is necessary
#' rslt2 <- revision_analysis(vintages, gap = 1, view = "diagonal", n.releases = 3)
#' # render_report(rslt2)
#' # render_report(rslt2, output_file = "report2", output_dir = "C:/Users/xxx",
#' # output_format = "word_document", plot_revisions = TRUE)
#' summary(rslt2)
#' View(rslt2)
#'
Expand All @@ -93,7 +94,7 @@
#' vintage_selection = c(start = "2012-12-31", end = "2018-06-30")
#' )
#' rslt3 <- revision_analysis(vintages, gap = 2, view = "vertical")
#' #render_report(rslt3)
#' #render_report(rslt3, output_file = "report2", output_dir = "C:/Users/xxx", plot_revisions = TRUE)
#' summary(rslt3)
#' View(rslt3)
#'
Expand Down
5 changes: 2 additions & 3 deletions R/revisions.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ plot.rjd3rev_revisions <- function(x, view = c("vertical", "diagonal"), n_rev =
#' @exportS3Method print rjd3rev_revisions
#' @export
#'

print.rjd3rev_revisions <- function(x, n_row = 12, n_col = 3, ...) {

# Check counts
Expand All @@ -132,7 +131,7 @@ print.rjd3rev_revisions <- function(x, n_row = 12, n_col = 3, ...) {
frequency = freq,
end = end_period)
extract_hv <- x$horizontal_view[(n_col_tot - n_col + 1):n_col_tot, (n_row_tot - n_row + 1):n_row_tot]
extract_dv <- stats::ts(x$diagonal_view[1:n_row, 1:n_col],
extract_dv <- stats::ts(x$diagonal_view[(n_row_tot - n_row + 1):n_row_tot, 1:n_col],
frequency = freq,
end = end_period)

Expand All @@ -153,7 +152,7 @@ print.rjd3rev_revisions <- function(x, n_row = 12, n_col = 3, ...) {
summary.rjd3rev_revisions <- function(object, ...) {
x <- object
vv <- x$vertical_view
cat("Number of releases: ", ncol(vv))
cat("Number of release revisions: ", ncol(vv))
cat("\nCovered period:")
cat("\n \tFrom: ", stats::start(vv))
cat("\n \tTo: ", stats::end(vv))
Expand Down
2 changes: 1 addition & 1 deletion R/vintages.R
Original file line number Diff line number Diff line change
Expand Up @@ -526,7 +526,7 @@ print.rjd3rev_vintages <- function(x,
frequency = freq,
end = end_period)
extract_hv <- x$horizontal_view[(n_col_tot - n_col + 1):n_col_tot, (n_row_tot - n_row + 1):n_row_tot]
extract_dv <- stats::ts(x$diagonal_view[1:n_row, 1:n_col],
extract_dv <- stats::ts(x$diagonal_view[(n_row_tot - n_row + 1):n_row_tot, 1:n_col],
frequency = freq,
end = end_period)

Expand Down
1 change: 1 addition & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ render_report(
summary(rslt)
print(rslt)
View(rslt)
```

## Additional information
Expand Down
7 changes: 4 additions & 3 deletions man/revision_analysis.Rd

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

0 comments on commit c9f54ec

Please sign in to comment.