Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

options for strict tests; few enhancements #820

Merged
merged 26 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 35 additions & 9 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@ name: Check 🛠

on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
branches:
- main
push:
branches:
- main
workflow_dispatch:

jobs:
audit:
Expand Down Expand Up @@ -33,34 +41,52 @@ jobs:
unit-test-report-brand: >-
https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/thumbs/rtables.png
coverage:
if: github.event_name == 'pull_request'
name: Coverage 📔
uses: insightsengineering/r.pkg.template/.github/workflows/test-coverage.yaml@main
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
with:
sd-direction: upstream
linter:
if: github.event_name != 'push'
name: SuperLinter 🦸‍♀️
uses: insightsengineering/r.pkg.template/.github/workflows/linter.yaml@main
roxygen:
name: Roxygen 🅾
uses: insightsengineering/r.pkg.template/.github/workflows/roxygen.yaml@main
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
with:
sd-direction: upstream
auto-update: true
gitleaks:
name: gitleaks 💧
uses: insightsengineering/r.pkg.template/.github/workflows/gitleaks.yaml@main
spelling:
name: Spell Check 🆎
uses: insightsengineering/r.pkg.template/.github/workflows/spelling.yaml@main
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
links:
if: github.event_name == 'pull_request'
if: github.event_name != 'push'
name: Check URLs 🌐
uses: insightsengineering/r.pkg.template/.github/workflows/links.yaml@main
version:
name: Version Check 🏁
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: insightsengineering/r.pkg.template/.github/workflows/version.yaml@main
vbump:
name: Version Bump 🤜🤛
if: github.event_name == 'push'
uses: insightsengineering/r.pkg.template/.github/workflows/version-bump.yaml@main
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
version:
name: Version Check 🏁
uses: insightsengineering/r.pkg.template/.github/workflows/version.yaml@main
licenses:
name: License Check 🃏
uses: insightsengineering/r.pkg.template/.github/workflows/licenses.yaml@main
style:
if: github.event_name != 'push'
name: Style Check 👗
uses: insightsengineering/r.pkg.template/.github/workflows/style.yaml@main
with:
auto-update: true
grammar:
if: github.event_name != 'push'
name: Grammar Check 🔤
uses: insightsengineering/r.pkg.template/.github/workflows/grammar.yaml@main
61 changes: 33 additions & 28 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
---
# All available hooks: https://pre-commit.com/hooks.html
# R specific hooks: https://github.com/lorenzwalthert/precommit
default_stages: [commit]
default_language_version:
python: python3
repos:
- repo: https://github.com/lorenzwalthert/precommit
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.4.0
hooks:
- id: roxygenize
# roxygen requires loading pkg -> add dependencies from DESCRIPTION
- id: roxygenize
additional_dependencies:
- formatters
- magrittr
- methods
- checkmate
- htmltools
- stats
- stringi
# codemeta must be above use-tidy-description when both are used
# - id: codemeta-description-updated
- id: use-tidy-description
- id: spell-check
- formatters
- magrittr
- methods
- checkmate
- htmltools
- stats
- stringi
- id: use-tidy-description
- id: spell-check
exclude: >
(?x)^(
.*\.[rR]|
Expand All @@ -40,40 +41,44 @@ repos:
(.*/|)\.Rprofile|
(.*/|)\.travis\.y[a]?ml|
(.*/|)appveyor\.y[a]?ml|
(.*/|)CODEOWNERS|
(.*/|)DESCRIPTION|
(.*/|)LICENSE|
(.*/|)NAMESPACE|
(.*/|)staged_dependencies\.y[a]?ml|
(.*/|)renv/settings\.dcf|
(.*/|)renv\.lock|
(.*/|)WORDLIST|
\.github/workflows/.*|
data/.*|
)$
- id: readme-rmd-rendered
- id: parsable-R
- id: no-browser-statement
- id: no-debug-statement
- id: deps-in-desc
- repo: https://github.com/pre-commit/pre-commit-hooks
- id: readme-rmd-rendered
- id: parsable-R
- id: no-browser-statement
- id: no-debug-statement
- id: deps-in-desc
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-added-large-files
args: ['--maxkb=200']
- id: file-contents-sorter
- id: file-contents-sorter
files: '^\.Rbuildignore$'
- id: end-of-file-fixer
- id: end-of-file-fixer
exclude: '\.Rd'
- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
rev: v1.6.1
hooks:
# Only reuiqred when https://pre-commit.ci is used for config validation
- id: check-pre-commit-ci-config
- repo: local
- id: check-pre-commit-ci-config
- repo: local
hooks:
- id: forbid-to-commit
- id: forbid-to-commit
name: Don't commit common R artifacts
entry: Cannot commit .Rhistory, .RData, .Rds or .rds.
language: fail
files: '\.(Rhistory|RData|Rds|rds)$'
# `exclude: <regex>` to allow committing specific files

ci:
autoupdate_schedule: monthly
autoupdate_schedule: monthly
10 changes: 6 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@ Suggests:
testthat (>= 3.0.4),
tibble (>= 3.2.1),
tidyr (>= 1.1.3),
withr (>= 2.0.0),
xml2 (>= 1.1.0)
VignetteBuilder:
knitr
Config/Needs/verdepcheck: insightsengineering/formatters,
tidyverse/magrittr, rstudio/htmltools, tidymodels/broom, cran/car,
mllg/checkmate, tidyverse/dplyr, davidgohel/flextable, yihui/knitr,
davidgohel/officer, Merck/r2rtf, r-lib/testthat, tidyverse/tibble,
tidyverse/tidyr, r-lib/xml2
tidyverse/magrittr, mllg/checkmate, rstudio/htmltools,
gogolewski/stringi, tidymodels/broom, cran/car, tidyverse/dplyr,
davidgohel/flextable, yihui/knitr, davidgohel/officer, Merck/r2rtf,
r-lib/testthat, tidyverse/tibble, tidyverse/tidyr, r-lib/withr,
r-lib/xml2
Melkiades marked this conversation as resolved.
Show resolved Hide resolved
Encoding: UTF-8
Language: en-US
LazyData: true
Expand Down
52 changes: 26 additions & 26 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,29 @@
## rtables 0.6.6
### New Features
* Removed `ref_group` reordering in column splits so not to change the order.
* Added `bold` argument to `as_html` to bold specified elements, and `header_sep_line`
* Added `bold` argument to `as_html` to bold specified elements, and `header_sep_line`
argument to print a horizontal line under the table header in rendered HTML output.
* Duplicate referential footnotes are consolidated when tables are rendered.
* Section divisors can be set for analysis rows.
* Added setter and getter for section dividers (`section_div` and `section_div<-`). They also accept
split section structure assignment.
* Added `header_section_div` setters and getters for layout and table objects along with
* Added `header_section_div` setters and getters for layout and table objects along with
related `basic_table` parameter.
* Added `na_str` argument to `analyze_colvars` to set custom string to print in place of missing values.
* Added flat `data.frame` outputs for `as_result_df()` via flag parameters `as_viewer`, `as_strings`, and
* Added flat `data.frame` outputs for `as_result_df()` via flag parameters `as_viewer`, `as_strings`, and
`expand_colnames`.
* Migrated `export_as_pdf` function to `formatters`.
* Migrated `export_as_pdf` function to `formatters`.

### Bug Fixes
* Fixed a bug that was failing when wrapping and section dividers were used at the same time.
* Fixed a bug in `as_result_df` causing misalignment of column names.
* Fixed a bug that was not allowing path indexing as `row_paths()` was giving a different path due to it being made of
* Fixed a bug that was not allowing path indexing as `row_paths()` was giving a different path due to it being made of
named values.
* Fixed a bug in `as_result_df` when called on tables with less than 3 rows.

### Miscellaneous
* Applied `styler` and resolved package lint. Changed default indentation from 4 spaces to 2.
* Added Developer Guide to pkgdown site with Debugging, Split Machinery, and Tabulation sections.
* Added Developer Guide with Debugging, Split Machinery, and Tabulation sections.
* Whitespace is not trimmed when rendering tables with `as_html`.
* Started deprecation cycle for `col_fnotes_here` to be replaced with `col_footnotes`.
* Exported `section_div` methods now have a dedicated documentation page that is visible to users.
Expand Down Expand Up @@ -82,7 +82,7 @@
* Removed superfluous warning which arose for custom split functions when reference group is is set (https://github.com/insightsengineering/rtables/issues/707#issuecomment-1678810598).
* Fixed `qtable` labeling via `row_labels` ([#698](https://github.com/insightsengineering/rtables/issues/698)).
* Error catching and test coverage for cases where `alt_counts_df` presents different splits from `df`.

### Miscellaneous
* Cleaned up spelling in documentation ([#685](https://github.com/insightsengineering/rtables/issues/685))
* Custom appearance vignette updated with decimal alignment support.
Expand All @@ -99,16 +99,16 @@

## rtables 0.6.1
* Improved resilience of pagination machinery (`paginate_table`) by generalizing parameters' defaults (`cpp`, `lpp`, and `font_size`).
* Moved `export_as_txt` to `formatters`. Added to reexports.
* Moved `export_as_txt` to `formatters`. Added to reexports.
* Migrated `export_as_rtf` to `formatters`. Not re-exported.
* add `r2rtf` to Suggests
* pagination logic has been migrated completely (excepting page_by splits) to `formatters` and is now invoked from there. paginate_table remains as a convenience function.
* Removed warning in `str` method when called upon table objects.
* Provide `str` method for `VTableTree` objects with a default `max.level` of 3, as the infinite default from base is not
* Removed warning in `str` method when called upon table objects.
* Provide `str` method for `VTableTree` objects with a default `max.level` of 3, as the infinite default from base is not
useful or informative.
* default `font_size` value is now `8` across pagination and export machinery
* `margins` argument in pagination and export machinery now (correctly) interpreted as inches. This change is inherited from `formatters`
* `lpp` and `cpp` now default to `NA_integer_`, which is interpreted as inferring their value from the physical page size specified.
* `lpp` and `cpp` now default to `NA_integer_`, which is interpreted as inferring their value from the physical page size specified.
* Horizontal pagination now occurs by default due to the above (because there is a default page type - `"letter"`. Pagination can still be turned off in either direction by setting `l/cpp` to `NULL` explicitly.
* Referential footnotes now have both a `symbol` and an `index`. Messages associated with symbols will only appear once per page in the footer materials regardless of number of elements referenced in the page with that symbol. Matches and inherits from changes in `formatters`
* Started deprecation cycle for `trim_zero_rows`.
Expand Down Expand Up @@ -143,7 +143,7 @@
* `export_to_txt` now automatically paginates when any form of page dimension is provided
(previously the default was unconditionally not paginating).
* Versioned dependency on `formatters` increased to `>=0.4.0`

## rtables 0.5.3
* `[<-` now treats character `i` and `j` values as paths, the same as `[` always has.
* `[<-` `CellValue` method now preserves `CellValue` attributes (e.g., format)
Expand All @@ -158,7 +158,7 @@
* export functions now accepts `tf_wrap` and `max_width` and use them in both pagination (when turned on) *and* `toString` when used (pdf, txt exporters).
* versioned dependency on `formatters` increased to `>0.3.3.10`
* `export_as_pdf` now accepts standard page/font size parameters
* original parameters (`width`, `height`, `fontsize` are soft deprecated (no warning) and
* original parameters (`width`, `height`, `fontsize` are soft deprecated (no warning) and
will be fully deprecated and then removed in the future.
* `toString` method for `VTableTree` now accepts `tf_wrap` and `max_width`
* `export_as_txt` and `export_as_pdf` now accept `cpp`, as well as `tf_wrap` and `max_width` and
Expand Down Expand Up @@ -187,7 +187,7 @@
* Updated versioned dependency on `formatters` to `>=0.3.2.3`
* Equivalent split functions with different enclosing environments (e.g., 2 identical calls to `add_combo_levels` [#340](https://github.com/insightsengineering/rtables/issues/304)) no longer block `rbind`ing
* Fixed various documentation bugs where description section was being added to header.

## rtables 0.5.1.4
* empty level check for splitting variables reinstated.

Expand All @@ -201,7 +201,7 @@
* `col_counts` getter and setter now accept `path` argument.
* empty levels of a splitting variable now result in an informative error message (character and factor cases).
* fixed bug in handling of column extra arguments that was preventing `cbind`ing tables from working correctly ([#324]](https://github.com/insightsengineering/rtables/issues/324))

## rtables 0.5.1
* empty factor levels are now *not* dropped for column splits when ref_group is set ([#323](https://github.com/insightsengineering/rtables/issues/323))
* `linesep` argument to `toString` and related functions renamed to `hsep`
Expand All @@ -210,15 +210,15 @@
* New `hsep` argument to `build_table` which sets the horizontal separator for the constructed table (and subtables thereof)
* New `horizontal_sep` and `horizontal_sep<-` accessors for constructed tables, the latter of which is mandatorily recursive.
* `split_rows_by(var, child_labels="hidden")` no longer removes the structural subtable corresponding to levels of `var` ([#314](https://github.com/insightsengineering/rtables/issues/314))

## rtables 0.5.0
* `formatable` dependency renamed to `formatters` for suitability of release to CRAN
* Update versioned dependency of `formatters` (previously `formatable`) to `>=0.2.0`
* Update versioned dependency of `formatters` (previously `formatable`) to `>=0.2.0`

## rtables 0.4.1.0004
* Fix bug when function format combined with NULL `cfun` caused error ([#307](https://github.com/insightsengineering/rtables/issues/307))
* Fix bug in `path_enriched_df` (which powers `tsv` export), related to ([#308](https://github.com/insightsengineering/rtables/issues/308))

## rtables 0.4.1.0002
* added `table_shell` to display shell of table with formats

Expand All @@ -236,14 +236,14 @@
* new `tt_to_flextable` coercion function
* new `export_as_pdf` exporter function
* `value_at` and `cell_values` functions now have methods for `TableRow` objects making them usable in sorting/pruning functions

## rtables 0.3.8.9001
* new `trim_levels_to_map` split function based on `[@wwojciech](https://github.com/wwojciech)`'s work in [#203](https://github.com/insightsengineering/rtables/issues/203)
* support for column referential footnotes
* support for adding footnotes to existing table via `fnotes_at_path<-` function
* `trim_levels_in_group` now trims empty levels of outer (split) variable by default
* `value_at` and `cell_values` now work for `tablerow` objects
* Fixed `as_html` bug in `multivar` split columns case
* Fixed `as_html` bug in `multivar` split columns case
* Fixed pagination off-by-one error


Expand Down Expand Up @@ -319,8 +319,8 @@ tables in the context of clinical trials.

## rtables 0.3.2.17.9041

* Allow single variable to be used within `split_cols_by_multivar`
* Various removal of defunct
* Allow single variable to be used within `split_cols_by_multivar`
* Various removal of defunct

## rtables 0.3.2.17.9040

Expand Down Expand Up @@ -366,7 +366,7 @@ tables in the context of clinical trials.

## rtables 0.3.2.17.9027

* issues with no news:
* issues with no news:

## rtables 0.1.7

Expand All @@ -389,7 +389,7 @@ tables in the context of clinical trials.
* `col_by` in `rtabulate` now accepts matrices:
- `col_by_to_matrix`, `col_by_to_factor`, `by_factor_to_matrix`.
- `by_add_total`, `by_all`, `by_combine`, `by_quartile`, `by_compare_subset`, `by_hierarchical`, `by_drop_empty_cols`.

* New utility functions to deal with variable labels:
- `label`, `var_labels<-`, `var_labels`, `var_labels_remove`, `var_relabel`, `with_label`.

Expand Down
1 change: 0 additions & 1 deletion R/Viewer.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ NULL
#' @return not meaningful. Called for the side effect of opening a browser or viewer pane.
#'
#' @examples
#'
#' if (interactive()) {
#' sl5 <- factor(iris$Sepal.Length > 5,
#' levels = c(TRUE, FALSE),
Expand Down
4 changes: 2 additions & 2 deletions R/argument_conventions.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ NULL
#' @param hsep character(1). Set of character(s) to be repeated as the separator
#' between the header and body of the table when rendered as text. Defaults to
#' a connected horizontal line (unicode 2014) in locals that use a UTF
#' charset, and to `-` elsewhere (with a once per session warning). See
#' charset, and to `-` elsewhere (with a once per session warning). See
#' [formatters::set_default_hsep()] for further information.
#' @param indent_size numeric(1). Number of spaces to use per indent level.
#' Defaults to 2
Expand Down Expand Up @@ -228,7 +228,7 @@ lyt_args <- function(lyt, var, vars, label, labels_var, varlabels, varnames, spl
#' represents a single facet.
#' @param header_section_div character(1). String which will be used to divide the header
#' from the table. See [header_section_div()] for getter and setter of these.
#' Please consider changing last element of [section_div()] when concatenating
#' Please consider changing last element of [section_div()] when concatenating
#' tables that need a divider between them.
#' @param page_title character. Page specific title(s).
#' @rdname constr_args
Expand Down
Loading
Loading