Skip to content

Commit

Permalink
update print method and document
Browse files Browse the repository at this point in the history
  • Loading branch information
TanguyBarthelemy committed Aug 14, 2024
1 parent c0bc38d commit ccf77c5
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 46 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ S3method(create_vintages,matrix)
S3method(create_vintages,mts)
S3method(plot,rjd3rev_revisions)
S3method(plot,rjd3rev_vintages)
S3method(print,default)
S3method(print,rjd3rev_revisions)
S3method(print,rjd3rev_rslts)
S3method(print,rjd3rev_vintages)
Expand Down
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,18 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

* user-defined thresholds for tests assessment
* possibility to add plot of revisions in report
* New `View()`, `summary()` and `print()` method to visualize the revision analysis


### Changed

* pivot from {formattable} dependency to {flextable} to build the tables
* `simulate_long()` is now an exported function to construct datasets example


## [1.3.2] - 2024-07-10

Expand Down
2 changes: 0 additions & 2 deletions R/format_table.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,3 @@ format_table <- function(x, col = "Tests") {
colnames(formatted_table)[1] <- col
return(formatted_table)
}


41 changes: 16 additions & 25 deletions R/revision_analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -700,21 +700,25 @@ regression_diagnostics <- function(reg_output, thr_res_jb, thr_res_bp, thr_res_w

# Generic functions ------------------------------------------------------------

#' Print function for objects of class "rjd3rev_rslts"
#' @export
#' @title Print function for objects of class \code{rjd3rev_rslts}
#'
#' @param x an object of class \code{rjd3rev_rslts}
#' @param \dots further arguments passed to the \code{\link{print}} function.
#'
#' @exportS3Method print rjd3rev_rslts
#' @method print rjd3rev_rslts
#' @export
#'
print.rjd3rev_rslts <- function(x, ...) {
print(list(call = x$call,
descriptive_statistics = x$descriptive.statistics,
parametric_analysis = x$summary, ...))
print(x$summary)
}

#' Summary function for objects of class "rjd3rev_rslts"
#' Summary function for objects of class \code{rjd3rev_rslts}
#'
#' @param object an object of class "rjd3rev_rslts"
#' @param object an object of class \code{rjd3rev_rslts}
#' @param ... further arguments passed to or from other methods.
#' @exportS3Method summary rjd3rev_rslts
#' @method summary rjd3rev_rslts
#' @export
#'
summary.rjd3rev_rslts <- function(object, ...) {
Expand All @@ -738,18 +742,6 @@ summary.rjd3rev_rslts <- function(object, ...) {
print(summary_tests)
}

#' print function for objects of class "rjd3rev_rslts"
#'
#' @param x an object of class "rjd3rev_rslts"
#' @param ... further arguments passed to or from other methods.
#' @exportS3Method print rjd3rev_rslts
#' @method print default
#' @export
#'
print.rjd3rev_rslts <- function(x, ...) {
print(x$summary)
}

#' @rdname View
#' @export
View <- function(x, ...) {
Expand Down Expand Up @@ -798,10 +790,9 @@ build_table <- function(x, type = c("summary", "stats-desc", "revisions", "tests
theme_design()
return(stat_desc)
} else if (type == "revisions") {
revisions_table <- data.frame(
Time = time(x$revisions),
x$revisions,
check.names = FALSE) |>
revisions_table <- data.frame(Time = time(x$revisions),
x$revisions,
check.names = FALSE) |>
flextable::flextable() |>
theme_design()
return(revisions_table)
Expand All @@ -812,9 +803,9 @@ build_table <- function(x, type = c("summary", "stats-desc", "revisions", "tests
return(invisible(NULL))
}

#' View function for objects of class "rjd3rev_rslts"
#' View function for objects of class \code{rjd3rev_rslts}
#'
#' @param x an object of class "rjd3rev_rslts"
#' @param x an object of class \code{rjd3rev_rslts}
#' @param type type of view to display
#' @param ... further arguments passed to \code{\link{View}}.
#'
Expand Down
2 changes: 1 addition & 1 deletion R/revisions.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ plot.rjd3rev_revisions <- function(x, view = c("vertical", "diagonal"), n_rev =
#' @param n_col number of columns to display. Can be either the last n columns
#' (verical view), the last n rows (horizontal view) or the first n columns
#' (diagonal view).
#' @param \dots further arguments passed to the print() function.
#' @param \dots further arguments passed to the \code{\link{print}} function.
#' @exportS3Method print rjd3rev_revisions
#' @export
#'
Expand Down
2 changes: 1 addition & 1 deletion R/vintages.R
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ create_vintages_from_xlsx <- function(file,
#' @param n_col number of columns to display. Can be either the last n columns
#' (verical view), the last n rows (horizontal view) or the first n columns
#' (diagonal view). This argument is not used for the long view.
#' @param ... further arguments passed to the print() function.
#' @param ... further arguments passed to the \code{\link{print}} function.
#'
#' @exportS3Method print rjd3rev_vintages
#' @method print rjd3rev_vintages
Expand Down
6 changes: 3 additions & 3 deletions man/View.rjd3rev_rslts.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/print.rjd3rev_revisions.Rd

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

12 changes: 4 additions & 8 deletions man/print.rjd3rev_rslts.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/print.rjd3rev_vintages.Rd

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

6 changes: 3 additions & 3 deletions man/summary.rjd3rev_rslts.Rd

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

0 comments on commit ccf77c5

Please sign in to comment.