Skip to content

Commit

Permalink
Match code and documentation (#299)
Browse files Browse the repository at this point in the history
While checking for other issues I noticed in the examples some mismatch
between the text and the result.
I also observed some differences between the options on the code and the
documented options.

While checking the package I saw:

```
─  checking examples ... [22s] OK (23.2s)
   Examples with CPU (user + system) or elapsed time > 5s
            user system elapsed
   Reporter 2.61   0.14    7.09
   Renderer 2.30   0.30    7.74
```

The problem might come from each method creating a new card and
reporter, see r-lib/roxygen2#1521 for the
underlying issue and linked issues here.
  • Loading branch information
llrs-roche authored Jan 22, 2025
1 parent 5c18d08 commit e4b0145
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ Imports:
R6,
rlistings (>= 0.2.10),
rmarkdown (>= 2.23),
rtables (>= 0.6.10.9004),
rtables.officer (>= 0.0.1.9005),
rtables (>= 0.6.11),
rtables.officer (>= 0.0.2),
shiny (>= 1.6.0),
shinybusy (>= 0.3.2),
shinyWidgets (>= 0.5.1),
Expand Down
4 changes: 2 additions & 2 deletions R/Renderer.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Renderer <- R6::R6Class( # nolint: object_name_linter.
#' card2 <- ReportCard$new()
#'
#' card2$append_text("Header 2 text", "header2")
#' card2$append_text("A paragraph of default text", "header2")
#' card2$append_text("A paragraph of default text")
#' lyt <- analyze(split_rows_by(basic_table(), "Day"), "Ozone", afun = mean)
#' table_res2 <- build_table(lyt, airquality)
#' card2$append_table(table_res2)
Expand Down Expand Up @@ -160,7 +160,7 @@ Renderer <- R6::R6Class( # nolint: object_name_linter.
#' card2 <- ReportCard$new()
#'
#' card2$append_text("Header 2 text", "header2")
#' card2$append_text("A paragraph of default text", "header2")
#' card2$append_text("A paragraph of default text")
#' lyt <- analyze(split_rows_by(basic_table(), "Day"), "Ozone", afun = mean)
#' table_res2 <- build_table(lyt, airquality)
#' card2$append_table(table_res2)
Expand Down
2 changes: 1 addition & 1 deletion R/ReportCard.R
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ ReportCard <- R6::R6Class( # nolint: object_name_linter.
#' @description Appends a text paragraph to this `ReportCard`.
#'
#' @param text (`character`) The text content to add.
#' @param style (`character(1)`) the style of the paragraph. One of: `default`, `header`, `verbatim`
#' @param style (`character(1)`) the style of the paragraph. One of: `r TextBlock$new()$get_available_styles()`.
#' @return `self`, invisibly.
#' @examples
#' card <- ReportCard$new()$append_text("A paragraph of default text")
Expand Down
12 changes: 6 additions & 6 deletions R/Reporter.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ Reporter <- R6::R6Class( # nolint: object_name_linter.
#' card1 <- ReportCard$new()
#'
#' card1$append_text("Header 2 text", "header2")
#' card1$append_text("A paragraph of default text", "header2")
#' card1$append_text("A paragraph of default text")
#' card1$append_plot(
#' ggplot(iris, aes(x = Petal.Length)) + geom_histogram()
#' )
#'
#' card2 <- ReportCard$new()
#'
#' card2$append_text("Header 2 text", "header2")
#' card2$append_text("A paragraph of default text", "header2")
#' card2$append_text("A paragraph of default text")
#' lyt <- analyze(split_rows_by(basic_table(), "Day"), "Ozone", afun = mean)
#' table_res2 <- build_table(lyt, airquality)
#' card2$append_table(table_res2)
Expand All @@ -64,15 +64,15 @@ Reporter <- R6::R6Class( # nolint: object_name_linter.
#' card1 <- ReportCard$new()
#'
#' card1$append_text("Header 2 text", "header2")
#' card1$append_text("A paragraph of default text", "header2")
#' card1$append_text("A paragraph of default text")
#' card1$append_plot(
#' ggplot(iris, aes(x = Petal.Length)) + geom_histogram()
#' )
#'
#' card2 <- ReportCard$new()
#'
#' card2$append_text("Header 2 text", "header2")
#' card2$append_text("A paragraph of default text", "header2")
#' card2$append_text("A paragraph of default text")
#' lyt <- analyze(split_rows_by(basic_table(), "Day"), "Ozone", afun = mean)
#' table_res2 <- build_table(lyt, airquality)
#' card2$append_table(table_res2)
Expand All @@ -96,15 +96,15 @@ Reporter <- R6::R6Class( # nolint: object_name_linter.
#' card1 <- ReportCard$new()
#'
#' card1$append_text("Header 2 text", "header2")
#' card1$append_text("A paragraph of default text", "header2")
#' card1$append_text("A paragraph of default text")
#' card1$append_plot(
#' ggplot(iris, aes(x = Petal.Length)) + geom_histogram()
#' )
#'
#' card2 <- ReportCard$new()
#'
#' card2$append_text("Header 2 text", "header2")
#' card2$append_text("A paragraph of default text", "header2")
#' card2$append_text("A paragraph of default text")
#' lyt <- analyze(split_rows_by(basic_table(), "Day"), "Ozone", afun = mean)
#' table_res2 <- build_table(lyt, airquality)
#' card2$append_table(table_res2)
Expand Down
4 changes: 2 additions & 2 deletions man/Renderer.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/ReportCard.Rd

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

12 changes: 6 additions & 6 deletions man/Reporter.Rd

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

0 comments on commit e4b0145

Please sign in to comment.