├── .Rbuildignore ├── .github ├── CODEOWNERS ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE │ ├── cran-release.yml │ ├── new_table.html │ ├── new_table.md │ ├── new_table.yml │ └── release.yml └── workflows │ ├── check.yaml │ ├── cla.yaml │ ├── docs.yaml │ ├── post-release.yaml │ ├── release.yaml │ └── scheduled.yaml ├── .gitignore ├── .gitlab-ci.yml ├── .lintr ├── .pre-commit-config.yaml ├── CODE_OF_CONDUCT.md ├── DESCRIPTION ├── LICENSE ├── NAMESPACE ├── NEWS.md ├── R ├── ael01_nollt.R ├── ael02.R ├── ael03.R ├── aet01.R ├── aet01_aesi.R ├── aet02.R ├── aet03.R ├── aet04.R ├── aet05.R ├── aet05_all.R ├── aet10.R ├── assertions.R ├── cfbt01.R ├── checks.R ├── chevron_tlg-S4class.R ├── chevron_tlg-S4methods.R ├── cml02a_gl.R ├── cmt01a.R ├── cmt02_pt.R ├── coxt01.R ├── coxt02.R ├── data.R ├── dmt01.R ├── dst01.R ├── dtht01.R ├── dummy_template.R ├── egt01.R ├── egt02.R ├── egt03.R ├── egt05_qtcat.R ├── ext01.R ├── fstg01.R ├── fstg02.R ├── gen_args.R ├── kmg01.R ├── lbt01.R ├── lbt04.R ├── lbt05.R ├── lbt06.R ├── lbt07.R ├── lbt14.R ├── lbt15.R ├── mht01.R ├── mng01.R ├── package.R ├── pdt01.R ├── pdt02.R ├── reexports.R ├── report_null.R ├── rmpt01.R ├── rmpt03.R ├── rmpt04.R ├── rmpt05.R ├── rmpt06.R ├── rspt01.R ├── rtables_utils.R ├── standard_rules.R ├── ttet01.R ├── unwrap.R ├── utils.R ├── vst01.R ├── vst02.R └── zzz.R ├── README.md ├── SECURITY.md ├── _pkgdown.yaml ├── chevron.Rproj ├── data-raw ├── grade_dir.R └── syn_data_creation.R ├── data ├── ctcv4_dir.rda ├── ctcv5_dir.rda ├── mla_dir.rda └── syn_data.rda ├── inst ├── WORDLIST └── extdata │ ├── ctcdir.csv │ ├── ctcgrades.csv │ └── mladir.csv ├── man ├── ael01_nollt.Rd ├── ael02.Rd ├── ael03.Rd ├── aet01.Rd ├── aet01_aesi.Rd ├── aet01_aesi_lyt.Rd ├── aet01_lyt.Rd ├── aet02.Rd ├── aet03.Rd ├── aet03_lyt.Rd ├── aet04.Rd ├── aet04_lyt.Rd ├── aet05.Rd ├── aet05_all.Rd ├── aet05_lyt.Rd ├── aet10.Rd ├── aet10_lyt.Rd ├── afun_p.Rd ├── afun_skip.Rd ├── args_ls.Rd ├── assert_single_value.Rd ├── assert_valid_type.Rd ├── assert_valid_var.Rd ├── assert_valid_var_pair.Rd ├── assert_valid_variable.Rd ├── cfbt01.Rd ├── cfbt01_lyt.Rd ├── check_all_colnames.Rd ├── check_one_colnames.Rd ├── chevron-package.Rd ├── chevron_tlg-class.Rd ├── cml02a_gl.Rd ├── cmt01a.Rd ├── cmt02_pt.Rd ├── convert_to_month.Rd ├── count_children.Rd ├── count_or_summarize.Rd ├── count_patients_recursive.Rd ├── coxt01.Rd ├── coxt01_lyt.Rd ├── coxt02.Rd ├── create_id_listings.Rd ├── ctcv4_dir.Rd ├── ctcv5_dir.Rd ├── dataset.Rd ├── deparse_print.Rd ├── dmt01.Rd ├── dmt01_lyt.Rd ├── do_call.Rd ├── dose_change_rule.Rd ├── dst01.Rd ├── dst01_lyt.Rd ├── dtht01.Rd ├── dtht01_lyt.Rd ├── dummy_template.Rd ├── egt01.Rd ├── egt02_1.Rd ├── egt02_2.Rd ├── egt02_lyt.Rd ├── egt03.Rd ├── egt03_lyt.Rd ├── egt05_qtcat.Rd ├── egt05_qtcat_lyt.Rd ├── empty_rule.Rd ├── execute_with_args.Rd ├── expand_list.Rd ├── ext01.Rd ├── ext01_lyt.Rd ├── figures │ └── logo.svg ├── format_date.Rd ├── fstg01.Rd ├── fstg02.Rd ├── fuse_sequentially.Rd ├── gen_args.Rd ├── get_grade_rule.Rd ├── get_page_by.Rd ├── get_section_div.Rd ├── get_subset.Rd ├── get_x_hjust.Rd ├── get_x_vjust.Rd ├── gg_list.Rd ├── gg_theme_chevron.Rd ├── grob_list.Rd ├── h_format_dec.Rd ├── h_unwrap_layout.Rd ├── ifneeded_split_col.Rd ├── ifneeded_split_row.Rd ├── kmg01.Rd ├── lbt01.Rd ├── lbt04.Rd ├── lbt04_lyt.Rd ├── lbt05.Rd ├── lbt05_lyt.Rd ├── lbt06.Rd ├── lbt06_lyt.Rd ├── lbt07.Rd ├── lbt07_lyt.Rd ├── lbt14.Rd ├── lbt14_lyt.Rd ├── lbt15.Rd ├── listing_format_chevron.Rd ├── lvls.Rd ├── main.Rd ├── mht01.Rd ├── missing_rule.Rd ├── mla_dir.Rd ├── mng01.Rd ├── modify_character.Rd ├── nocoding.Rd ├── obtain_value.Rd ├── occurrence_lyt.Rd ├── outcome_rule.Rd ├── pdt01.Rd ├── pdt01_lyt.Rd ├── pdt02.Rd ├── pdt02_lyt.Rd ├── postprocess.Rd ├── preprocess.Rd ├── print_args.Rd ├── print_list.Rd ├── proportion_lyt.Rd ├── prune_except.Rd ├── reexports.Rd ├── report_null.Rd ├── rmpt01.Rd ├── rmpt01_lyt.Rd ├── rmpt03.Rd ├── rmpt04.Rd ├── rmpt05.Rd ├── rmpt06.Rd ├── rmpt06_lyt.Rd ├── rspt01.Rd ├── rspt01_lyt.Rd ├── run.Rd ├── s_summary_na.Rd ├── script.Rd ├── set_section_div.Rd ├── smart_prune.Rd ├── split_rows_by_recursive.Rd ├── std_listing.Rd ├── std_postprocessing.Rd ├── summarize_vars_allow_na.Rd ├── syn_data.Rd ├── ttet01.Rd ├── ttet01_lyt.Rd ├── unwrap_layout.Rd ├── var_labels_for.Rd ├── vst01.Rd ├── vst02_1.Rd ├── vst02_2.Rd ├── vst02_lyt.Rd └── yes_no_rule.Rd ├── revdep └── .gitignore ├── tests ├── testthat.R └── testthat │ ├── _snaps │ ├── ael01_nollt.md │ ├── ael02.md │ ├── ael03.md │ ├── aet01.md │ ├── aet01_aesi.md │ ├── aet02.md │ ├── aet03.md │ ├── aet04.md │ ├── aet05.md │ ├── aet05_all.md │ ├── aet10.md │ ├── cfbt01.md │ ├── chevron_tlg-methods.md │ ├── cml02a_gl.md │ ├── cmt01a.md │ ├── cmt02_pt.md │ ├── coxt01.md │ ├── coxt02.md │ ├── default_tlg.md │ ├── dmt01.md │ ├── dst01.md │ ├── dtht01.md │ ├── egt01.md │ ├── egt02.md │ ├── egt03.md │ ├── egt05_qtcat.md │ ├── ext01.md │ ├── lbt01.md │ ├── lbt04.md │ ├── lbt05.md │ ├── lbt06.md │ ├── lbt07.md │ ├── lbt14.md │ ├── lbt15.md │ ├── mht01.md │ ├── mng01 │ │ ├── mng01-with-custom-theme.svg │ │ ├── mng01-with-default-value.svg │ │ ├── run-mng01-with-combination-of-x-variables.svg │ │ ├── run-mng01-with-custom-color-set.svg │ │ ├── run-mng01-with-custom-line-type-set.svg │ │ ├── run-mng01-with-custom-unnamed-color-set.svg │ │ ├── run-mng01-with-custom-unnamed-line-type-set.svg │ │ ├── run-mng01-with-jitter.svg │ │ ├── run-mng01-with-numeric-x-variables.svg │ │ └── run-mng01-without-table.svg │ ├── pdt01.md │ ├── pdt02.md │ ├── rmpt01.md │ ├── rmpt03.md │ ├── rmpt04.md │ ├── rmpt05.md │ ├── rmpt06.md │ ├── rspt01.md │ ├── ttet01.md │ ├── unwrap.md │ ├── utils.md │ ├── vst01.md │ └── vst02.md │ ├── setup-options.R │ ├── test-ael01_nollt.R │ ├── test-ael02.R │ ├── test-ael03.R │ ├── test-aet01.R │ ├── test-aet01_aesi.R │ ├── test-aet02.R │ ├── test-aet03.R │ ├── test-aet04.R │ ├── test-aet05.R │ ├── test-aet05_all.R │ ├── test-aet10.R │ ├── test-assertions.R │ ├── test-cfbt01.R │ ├── test-checks.R │ ├── test-chevron_tlg-class.R │ ├── test-chevron_tlg-methods.R │ ├── test-cml02a_gl.R │ ├── test-cmt01a.R │ ├── test-cmt02_pt.R │ ├── test-coxt01.R │ ├── test-coxt02.R │ ├── test-default_tlg.R │ ├── test-dmt01.R │ ├── test-dst01.R │ ├── test-dtht01.R │ ├── test-egt01.R │ ├── test-egt02.R │ ├── test-egt03.R │ ├── test-egt05_qtcat.R │ ├── test-empty_report.R │ ├── test-ext01.R │ ├── test-fstg01.R │ ├── test-fstg02.R │ ├── test-kmg01.R │ ├── test-lbt01.R │ ├── test-lbt04.R │ ├── test-lbt05.R │ ├── test-lbt06.R │ ├── test-lbt07.R │ ├── test-lbt14.R │ ├── test-lbt15.R │ ├── test-mht01.R │ ├── test-mng01.R │ ├── test-pdt01.R │ ├── test-pdt02.R │ ├── test-reexports.R │ ├── test-report_null.R │ ├── test-rmpt01.R │ ├── test-rmpt03.R │ ├── test-rmpt04.R │ ├── test-rmpt05.R │ ├── test-rmpt06.R │ ├── test-rspt01.R │ ├── test-ttet01.R │ ├── test-unwrap.R │ ├── test-utils.R │ ├── test-vst01.R │ └── test-vst02.R └── vignettes ├── .gitignore ├── chevron.Rmd ├── chevron_catalog.rmd └── script_generator.Rmd /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^.*\.Rproj$ 2 | ^\.Rproj\.user$ 3 | ^\.pre-commit-config\.yaml$ 4 | ^data-raw 5 | ^temp$ 6 | ^\.github$ 7 | ^staged_dependencies\.yaml$ 8 | _pkgdown\.yaml 9 | docs 10 | ^\.lintr 11 | ^\.gitlab-ci\.yml 12 | CODE_OF_CONDUCT\.md 13 | SECURITY\.md 14 | ^doc$ 15 | ^Meta$ 16 | ^\.vscode$ 17 | ^pkgdown$ 18 | LICENSE 19 | ^.revdeprefs\.yaml$ 20 | ^revdep$ 21 | ^\.covrignore$ 22 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @clarkliming 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/new_table.md: -------------------------------------------------------------------------------- 1 | 2 | # New Table Request 3 | 4 | ---- 5 | 6 | ## Table Name 7 | 8 | Standard name of the table. 9 | _ex. AET02_ 10 | 11 | ## URL 12 | 13 | Link to an external file describing the table. 14 | Please make sure this is first added in [tlg-catalog](https://insightsengineering.github.io/tlg-catalog/stable/) 15 | 16 | ## Description 17 | 18 | Details on the generic purpose of the table 19 | _ex. This is an adverse event table_ 20 | 21 | ## Analysis dataset 22 | 23 | Name of the standard dataset input 24 | _ex. ADAE_ 25 | 26 | ## Analysis filtering 27 | 28 | Filtering criteria of the input 29 | _ex. ANL01FL == "Y"_ 30 | 31 | ## Analysis population 32 | 33 | The selected population, typically SE, AP or IT 34 | _ex. SE_ 35 | 36 | ## Column Variable 37 | 38 | Names of the columns splitting variables in hierarchical order 39 | _ex. ACTARM_ 40 | 41 | ## Analysis variables 42 | 43 | Names of the rows splitting variables in hierarchical order 44 | _ex. AEBODSYS, AEDECOD, ASEV_ 45 | _ex._ 46 | _1. AEBODSYS_ 47 | _2. AEDECOD_ 48 | _3. ASEV_ 49 | 50 | ## Analysis concept 51 | 52 | Alternative table description for summary tables similar to AET01 53 | _ex._ 54 | 55 | - _Serious AE_ 56 | - _Related AE_ 57 | - _Total number of AEs_ 58 | 59 | ## Statistics 60 | 61 | Description of the statistical procedure 62 | _ex. Frequency count and % (based on N)_ 63 | 64 | ## Default treatment of zero count rows 65 | 66 | Choose one option: 67 | 68 | - [ ] "Remove zero count rows by default" 69 | - [ ] "Keep zero count rows by default" 70 | - [x] "Always ask for user input" 71 | - [ ] "Not applicable / Other" 72 | 73 | ## Comments 74 | 75 | _ex. Some additional details_ 76 | 77 | ---- 78 | [see TLG catalog](https://insightsengineering.github.io/tlg-catalog/stable/) 79 | -------------------------------------------------------------------------------- /.github/workflows/cla.yaml: -------------------------------------------------------------------------------- 1 | name: CLA 🔏 2 | 3 | on: 4 | issue_comment: 5 | types: 6 | - created 7 | # For PRs that originate from forks 8 | pull_request_target: 9 | types: 10 | - opened 11 | - closed 12 | - synchronize 13 | 14 | jobs: 15 | CLA: 16 | name: CLA 📝 17 | uses: insightsengineering/.github/.github/workflows/cla.yaml@main 18 | secrets: inherit 19 | -------------------------------------------------------------------------------- /.github/workflows/docs.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Docs 📚 3 | 4 | on: 5 | push: 6 | branches: 7 | - main 8 | paths: 9 | - inst/templates/** 10 | - _pkgdown.* 11 | - DESCRIPTION 12 | - '**.md' 13 | - man/** 14 | - LICENSE.* 15 | - NAMESPACE 16 | pull_request: 17 | types: 18 | - opened 19 | - synchronize 20 | - reopened 21 | - ready_for_review 22 | branches: 23 | - main 24 | paths: 25 | - inst/templates/** 26 | - _pkgdown.* 27 | - DESCRIPTION 28 | - '**.md' 29 | - man/** 30 | - LICENSE.* 31 | - NAMESPACE 32 | workflow_dispatch: 33 | 34 | jobs: 35 | docs: 36 | name: Pkgdown Docs 📚 37 | uses: insightsengineering/r.pkg.template/.github/workflows/pkgdown.yaml@main 38 | secrets: 39 | REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} 40 | with: 41 | deps-installation-method: setup-r-dependencies 42 | default-landing-page: latest-tag 43 | additional-unit-test-report-directories: unit-test-report-non-cran 44 | -------------------------------------------------------------------------------- /.github/workflows/post-release.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Post release ✨ 3 | 4 | on: 5 | release: 6 | types: ["released"] 7 | 8 | jobs: 9 | vbump: 10 | name: Version Bump 🤜🤛 11 | uses: insightsengineering/r.pkg.template/.github/workflows/version-bump.yaml@main 12 | secrets: 13 | REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} 14 | with: 15 | vbump-after-release: true 16 | -------------------------------------------------------------------------------- /.github/workflows/release.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Release 🎈 3 | 4 | on: 5 | push: 6 | tags: 7 | - "v*" 8 | workflow_dispatch: 9 | 10 | jobs: 11 | docs: 12 | name: Pkgdown Docs 📚 13 | needs: release 14 | uses: insightsengineering/r.pkg.template/.github/workflows/pkgdown.yaml@main 15 | secrets: 16 | REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} 17 | with: 18 | default-landing-page: latest-tag 19 | validation: 20 | name: R Package Validation report 📃 21 | needs: release 22 | uses: insightsengineering/r.pkg.template/.github/workflows/validation.yaml@main 23 | secrets: 24 | REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} 25 | release: 26 | name: Create release 🎉 27 | uses: insightsengineering/r.pkg.template/.github/workflows/release.yaml@main 28 | secrets: 29 | REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} 30 | build: 31 | name: Build package and reports 🎁 32 | needs: [release, docs] 33 | uses: insightsengineering/r.pkg.template/.github/workflows/build-check-install.yaml@main 34 | secrets: 35 | REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 36 | with: 37 | additional-env-vars: | 38 | _R_CHECK_CRAN_INCOMING_REMOTE_=false 39 | additional-r-cmd-check-params: --as-cran 40 | enforce-note-blocklist: true 41 | note-blocklist: | 42 | checking dependencies in R code .* NOTE 43 | checking R code for possible problems .* NOTE 44 | checking examples .* NOTE 45 | checking Rd line widths .* NOTE 46 | checking top-level files .* NOTE 47 | unit-test-report-brand: >- 48 | https://raw.githubusercontent.com/insightsengineering/hex-stickers/main/SVG/chevron.svg 49 | coverage: 50 | name: Coverage 📔 51 | needs: [release, docs] 52 | uses: insightsengineering/r.pkg.template/.github/workflows/test-coverage.yaml@main 53 | secrets: 54 | REPO_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 55 | with: 56 | additional-env-vars: | 57 | NOT_CRAN=true 58 | wasm: 59 | name: Build WASM packages 🧑‍🏭 60 | needs: release 61 | uses: insightsengineering/r.pkg.template/.github/workflows/wasm.yaml@main 62 | -------------------------------------------------------------------------------- /.github/workflows/scheduled.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | name: Scheduled 🕰️ 3 | 4 | on: 5 | schedule: 6 | - cron: '45 3 * * 0' 7 | workflow_dispatch: 8 | inputs: 9 | chosen-workflow: 10 | description: | 11 | Select which workflow you'd like to run 12 | required: true 13 | type: choice 14 | default: rhub 15 | options: 16 | - rhub 17 | - dependency-test 18 | - branch-cleanup 19 | - revdepcheck 20 | 21 | jobs: 22 | dependency-test: 23 | if: > 24 | github.event_name == 'schedule' || ( 25 | github.event_name == 'workflow_dispatch' && 26 | inputs.chosen-workflow == 'dependency-test' 27 | ) 28 | strategy: 29 | fail-fast: false 30 | matrix: 31 | test-strategy: ["min_cohort", "min_isolated", "release", "max"] 32 | uses: insightsengineering/r.pkg.template/.github/workflows/verdepcheck.yaml@main 33 | name: Dependency Test - ${{ matrix.test-strategy }} 🔢 34 | secrets: 35 | REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} 36 | GCHAT_WEBHOOK: ${{ secrets.GCHAT_WEBHOOK }} 37 | with: 38 | strategy: ${{ matrix.test-strategy }} 39 | additional-env-vars: | 40 | PKG_SYSREQS_DRY_RUN=true 41 | branch-cleanup: 42 | if: > 43 | github.event_name == 'schedule' || ( 44 | github.event_name == 'workflow_dispatch' && 45 | inputs.chosen-workflow == 'branch-cleanup' 46 | ) 47 | name: Branch Cleanup 🧹 48 | uses: insightsengineering/r.pkg.template/.github/workflows/branch-cleanup.yaml@main 49 | secrets: 50 | REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }} 51 | revdepcheck: 52 | if: > 53 | github.event_name == 'schedule' || ( 54 | github.event_name == 'workflow_dispatch' && 55 | inputs.chosen-workflow == 'revdepcheck' 56 | ) 57 | name: revdepcheck ↩️ 58 | uses: insightsengineering/r.pkg.template/.github/workflows/revdepcheck.yaml@main 59 | rhub: 60 | if: > 61 | github.event_name == 'schedule' || ( 62 | github.event_name == 'workflow_dispatch' && 63 | inputs.chosen-workflow == 'rhub' 64 | ) 65 | name: R-hub 🌐 66 | uses: insightsengineering/r.pkg.template/.github/workflows/rhub.yaml@main 67 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .Rproj.user 2 | .Rhistory 3 | .RData 4 | .Ruserdata 5 | .DS_Store 6 | inst/doc 7 | docs 8 | temp 9 | *.bak 10 | .Renviron 11 | .Rprofile 12 | .vscode 13 | doc/ 14 | Meta/ 15 | *pdf 16 | tests/testthat/_snaps/**/*.new.md 17 | tests/testthat/_snaps/**/*.new.svg 18 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | 3 | include: 4 | - project: 'nest/automation/gitlab-shared-library' 5 | ref: main 6 | file: R/R_NEST_min.gitlab-ci.yml 7 | -------------------------------------------------------------------------------- /.lintr: -------------------------------------------------------------------------------- 1 | linters: linters_with_defaults( 2 | line_length_linter = line_length_linter(120), 3 | cyclocomp_linter = NULL, 4 | object_usage_linter = NULL 5 | ) 6 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | --- 2 | # All available hooks: https://pre-commit.com/hooks.html 3 | # R specific hooks: https://github.com/lorenzwalthert/precommit 4 | default_stages: [pre-commit] 5 | default_language_version: 6 | python: python3 7 | repos: 8 | - repo: https://github.com/lorenzwalthert/precommit 9 | rev: v0.4.3.9009 10 | hooks: 11 | - id: style-files 12 | name: Style code with `styler` 13 | args: [--style_pkg=styler, --style_fun=tidyverse_style, 14 | --cache-root=styler] 15 | - id: roxygenize 16 | name: Regenerate package documentation 17 | additional_dependencies: 18 | - checkmate 19 | - dplyr 20 | - dunlin 21 | - forcats 22 | - formatters 23 | - ggplot2 24 | - glue 25 | - grid 26 | - lifecycle 27 | - magrittr 28 | - methods 29 | - nestcolor 30 | - purrr 31 | - rlang 32 | - rlistings 33 | - rtables 34 | - stringr 35 | - tern 36 | - tibble 37 | - utils 38 | - id: spell-check 39 | name: Check spelling with `spelling` 40 | exclude: > 41 | (?x)^( 42 | .*\.[rR]| 43 | .*\.css| 44 | .*\.jpg| 45 | .*\.js| 46 | .*\.png| 47 | .*\.py| 48 | .*\.RData| 49 | .*\.Rds| 50 | .*\.rds| 51 | .*\.Rproj| 52 | .*\.sh| 53 | .*\.svg| 54 | .*\.xml| 55 | (.*/|)\_pkgdown.y[a]?ml| 56 | (.*/|)\.covrignore| 57 | (.*/|)\.gitignore| 58 | (.*/|)\.gitlab-ci\.y[a]?ml| 59 | (.*/|)\.lintr| 60 | (.*/|)\.pre-commit-.*| 61 | (.*/|)\.Rbuildignore| 62 | (.*/|)\.Renviron| 63 | (.*/|)\.Rprofile| 64 | (.*/|)CODEOWNERS| 65 | (.*/|)DESCRIPTION| 66 | (.*/|)LICENSE| 67 | (.*/|)NAMESPACE| 68 | .*\-package.Rd| 69 | (.*/|)staged_dependencies\.y[a]?ml| 70 | (.*/|)WORDLIST| 71 | \.github/.*\.y[a]?ml| 72 | data/.* 73 | )$ 74 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2022 F. Hoffmann-La Roche AG 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | -------------------------------------------------------------------------------- /R/ael01_nollt.R: -------------------------------------------------------------------------------- 1 | # ael01_nollt ---- 2 | 3 | #' @describeIn ael01_nollt Main TLG function 4 | #' 5 | #' @inheritParams std_listing 6 | #' @returns the main function returns an `rlistings` or a `list` object. 7 | #' 8 | #' @details 9 | #' * Removes duplicate rows. 10 | #' * By default, uses dataset `adae`, sorting by key columns `AEBODSYS` and `AEDECOD`. 11 | #' * If using with a dataset other than `adae`, be sure to specify the desired labels for variables in 12 | #' `key_cols` and `disp_cols`, and pre-process missing data. 13 | #' 14 | #' @note 15 | #' * `adam_db` object must contain the `dataset` table with columns specified by `key_cols` and `disp_cols`. 16 | #' 17 | #' @export 18 | #' 19 | ael01_nollt_main <- modify_default_args( 20 | std_listing, 21 | dataset = "adae", 22 | key_cols = c("AEBODSYS", "AEDECOD"), 23 | disp_cols = "AETERM", 24 | split_into_pages_by_var = NULL, 25 | unique_rows = TRUE 26 | ) 27 | 28 | #' @describeIn ael01_nollt Preprocessing 29 | #' 30 | #' @inheritParams ael01_nollt_main 31 | #' @returns the preprocessing function returns a `list` of `data.frame`. 32 | #' 33 | #' @export 34 | #' 35 | ael01_nollt_pre <- function(adam_db, 36 | dataset = "adae", 37 | key_cols = c("AEBODSYS", "AEDECOD"), 38 | disp_cols = "AETERM", 39 | ...) { 40 | adam_db[[dataset]] <- adam_db[[dataset]] %>% 41 | mutate( 42 | across(all_of(c(key_cols, disp_cols)), ~ reformat(.x, nocoding)) 43 | ) %>% 44 | arrange(pick(all_of(c(key_cols, disp_cols)))) 45 | 46 | adam_db 47 | } 48 | 49 | #' `AEL01_NOLLT` Listing 1 (Default) Glossary of Preferred Terms and Investigator-Specified Terms. 50 | #' 51 | #' @include chevron_tlg-S4class.R 52 | #' @export 53 | #' 54 | #' @examples 55 | #' run(ael01_nollt, syn_data) 56 | ael01_nollt <- chevron_l( 57 | main = ael01_nollt_main, 58 | preprocess = ael01_nollt_pre, 59 | dataset = c("adsl", "adae") 60 | ) 61 | -------------------------------------------------------------------------------- /R/aet05_all.R: -------------------------------------------------------------------------------- 1 | # aet05_all ---- 2 | 3 | #' @describeIn aet05_all Preprocessing 4 | #' 5 | #' @inheritParams gen_args 6 | #' @returns the preprocessing function returns a `list` of `data.frame`. 7 | #' @export 8 | #' 9 | aet05_all_pre <- function(adam_db, dataset = "adsaftte", ...) { 10 | anl_tte <- adam_db[[dataset]] %>% 11 | filter(.data$PARAMCD == "AEREPTTE") %>% 12 | select(all_of(c("USUBJID", "AVAL"))) 13 | 14 | adam_db[[dataset]] <- adam_db[[dataset]] %>% 15 | filter(grepl("TOT", .data$PARAMCD)) %>% 16 | mutate( 17 | N_EVENTS = as.integer(.data$AVAL), 18 | AVAL = NULL 19 | ) %>% 20 | left_join(anl_tte, by = c("USUBJID")) 21 | 22 | adam_db 23 | } 24 | 25 | #' `AET05_ALL` Table 1 (Default) Adverse Event Rate Adjusted for Patient-Years at Risk - All Occurrences. 26 | #' 27 | #' The `AET05_ALL` table produces the standard adverse event rate adjusted for patient-years at risk summary 28 | #' considering all occurrences. 29 | #' 30 | #' @include chevron_tlg-S4class.R 31 | #' @export 32 | #' 33 | #' @examples 34 | #' library(dplyr) 35 | #' library(dunlin) 36 | #' 37 | #' proc_data <- log_filter(syn_data, PARAMCD == "AETOT1" | PARAMCD == "AEREPTTE", "adsaftte") 38 | #' 39 | #' run(aet05_all, proc_data) 40 | #' 41 | #' run(aet05_all, proc_data, conf_level = 0.90, conf_type = "exact") 42 | aet05_all <- chevron_t( 43 | main = aet05_main, 44 | preprocess = aet05_all_pre, 45 | postprocess = aet05_post, 46 | dataset = c("adsl", "adsaftte") 47 | ) 48 | -------------------------------------------------------------------------------- /R/checks.R: -------------------------------------------------------------------------------- 1 | #' Check that all names are among column names 2 | #' 3 | #' @param df (`data.frame`) 4 | #' @param x (`character`) the names of the columns to be checked. 5 | #' @param null_ok (`flag`) can `x` be NULL. 6 | #' @param qualifier (`string`) to be returned if the check fails. 7 | #' @returns invisible `NULL` or a string if the criteria are not fulfilled. 8 | #' 9 | #' @keywords internal 10 | check_all_colnames <- function(df, x, null_ok = TRUE, qualifier = NULL) { 11 | assert_data_frame(df) 12 | assert_character(x, null.ok = null_ok) 13 | assert_string(qualifier, null.ok = TRUE) 14 | 15 | diff <- setdiff(x, colnames(df)) 16 | 17 | if (length(diff) == 0) { 18 | invisible(NULL) 19 | } else { 20 | paste(qualifier, "Expected column names:", toString(diff), "not in", deparse(substitute(df))) 21 | } 22 | } 23 | 24 | #' Check that at least one name is among column names 25 | #' 26 | #' @param df (`data.frame`) 27 | #' @param x (`character`) the names of the columns to be checked. 28 | #' @param null_ok (`flag`) can `x` be NULL. 29 | #' @param qualifier (`string`) to be returned if the check fails. 30 | #' @returns invisible `NULL` or a string if the criteria are not fulfilled. 31 | #' 32 | #' @keywords internal 33 | check_one_colnames <- function(df, x, null_ok = TRUE, qualifier = NULL) { 34 | assert_data_frame(df) 35 | assert_character(x, null.ok = null_ok) 36 | assert_string(qualifier, null.ok = TRUE) 37 | 38 | common <- intersect(x, colnames(df)) 39 | 40 | if (length(common) > 0) { 41 | invisible(NULL) 42 | } else { 43 | paste(qualifier, "At least one of:", toString(x), "is expected to be a column name of", deparse(substitute(df))) 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /R/cml02a_gl.R: -------------------------------------------------------------------------------- 1 | # cml02a_gl_main ---- 2 | 3 | #' @describeIn cml02a_gl Main TLG function 4 | #' 5 | #' @inheritParams gen_args 6 | #' @returns the main function returns an `rlistings` or a `list` object. 7 | #' @export 8 | #' 9 | cml02a_gl_main <- modify_default_args(std_listing, 10 | dataset = "adcm", 11 | key_cols = c("ATC2", "CMDECOD"), 12 | disp_cols = c("ATC2", "CMDECOD", "CMTRT"), 13 | split_into_pages_by_var = NULL, 14 | unique_rows = TRUE 15 | ) 16 | 17 | #' @describeIn cml02a_gl Preprocessing 18 | #' 19 | #' @inheritParams cml02a_gl_main 20 | #' @inheritParams gen_args 21 | #' @returns the preprocessing function returns a `list` of `data.frame`. 22 | #' 23 | #' @export 24 | #' 25 | cml02a_gl_pre <- function(adam_db, 26 | dataset = "adcm", 27 | disp_cols = c("ATC2", "CMDECOD", "CMTRT"), 28 | ...) { 29 | adam_db[[dataset]] <- adam_db[[dataset]] %>% 30 | mutate(across(all_of(disp_cols), ~ reformat(.x, nocoding))) %>% 31 | mutate( 32 | ATC2 = with_label(.data$ATC2, "ATC Class Level 2"), 33 | CMDECOD = with_label(.data$CMDECOD, "WHODrug Preferred Name"), 34 | CMTRT = with_label(.data$CMTRT, "Investigator-Specified Treatment Term") 35 | ) 36 | 37 | adam_db 38 | } 39 | 40 | #' `CML02A_GL` Listing 1 (Default) Concomitant Medication Class Level 2, Preferred Name, and Investigator-Specified 41 | #' Terms. 42 | #' 43 | #' @include chevron_tlg-S4class.R 44 | #' @export 45 | #' 46 | #' @examples 47 | #' run(cml02a_gl, syn_data) 48 | cml02a_gl <- chevron_l( 49 | main = cml02a_gl_main, 50 | preprocess = cml02a_gl_pre, 51 | dataset = c("adsl", "adcm") 52 | ) 53 | -------------------------------------------------------------------------------- /R/cmt02_pt.R: -------------------------------------------------------------------------------- 1 | # cmt02_pt ---- 2 | 3 | #' @describeIn cmt02_pt Main TLG function 4 | #' 5 | #' @inherit cmt01a_main 6 | #' @include cmt01a.R 7 | #' @returns the main function returns an `rtables` object. 8 | #' @export 9 | #' 10 | cmt02_pt_main <- modify_default_args( 11 | cmt01a_main, 12 | row_split_var = NULL, 13 | summary_labels = quote(list(TOTAL = cmt01_label)) 14 | ) 15 | 16 | #' @describeIn cmt02_pt Preprocessing 17 | #' 18 | #' @inherit cmt01a_pre 19 | #' @returns the preprocessing function returns a `list` of `data.frame`. 20 | #' @export 21 | #' 22 | cmt02_pt_pre <- cmt01a_pre 23 | 24 | #' @describeIn cmt02_pt Postprocessing 25 | #' 26 | #' @inherit cmt01a_post 27 | #' @returns the postprocessing function returns an `rtables` object or an `ElementaryTable` (null report). 28 | #' @export 29 | #' 30 | cmt02_pt_post <- modify_default_args(cmt01a_post, row_split_var = NULL) 31 | 32 | #' `CMT02_PT` Table 1 (Default) Concomitant Medications by Preferred Name. 33 | #' 34 | #' A concomitant medication table with the 35 | #' number of subjects and the total number of treatments by medication name sorted by frequencies. 36 | #' 37 | #' @include chevron_tlg-S4class.R 38 | #' @export 39 | #' 40 | #' @examples 41 | #' run(cmt02_pt, syn_data) 42 | cmt02_pt <- chevron_t( 43 | main = cmt02_pt_main, 44 | preprocess = cmt02_pt_pre, 45 | postprocess = cmt02_pt_post, 46 | dataset = c("adsl", "adcm") 47 | ) 48 | -------------------------------------------------------------------------------- /R/coxt02.R: -------------------------------------------------------------------------------- 1 | # coxt02 ---- 2 | 3 | #' @describeIn coxt02 Main TLG function 4 | #' 5 | #' @inherit coxt01_main 6 | #' @include utils.R 7 | #' @returns the main function returns an `rtables` object. 8 | #' 9 | #' @export 10 | #' 11 | coxt02_main <- modify_default_args(coxt01_main, multivar = TRUE) 12 | 13 | #' `COXT02` Multi-Variable Cox Regression Model Table. 14 | #' 15 | #' The `COXT02` table follows the same principles as the general Cox model analysis 16 | #' and produces the estimates for each of the covariates included in the model 17 | #' (usually the main effects without interaction terms). 18 | #' 19 | #' @include chevron_tlg-S4class.R 20 | #' @export 21 | #' 22 | #' @examples 23 | #' library(dunlin) 24 | #' 25 | #' proc_data <- log_filter(syn_data, PARAMCD == "CRSD", "adtte") 26 | #' 27 | #' run(coxt02, proc_data) 28 | #' 29 | #' run(coxt02, proc_data, covariates = c("SEX", "AAGE"), strata = c("RACE"), conf_level = 0.90) 30 | coxt02 <- chevron_t( 31 | main = coxt02_main, 32 | preprocess = coxt01_pre, 33 | postprocess = coxt01_post, 34 | dataset = c("adsl", "adtte") 35 | ) 36 | -------------------------------------------------------------------------------- /R/data.R: -------------------------------------------------------------------------------- 1 | # syn_data ---- 2 | 3 | #' Example `adam` Synthetic Data 4 | #' 5 | #' @format A named `list` of 13 `data.frames`: 6 | #' - `adsl` 7 | #' - `adae` 8 | #' - `adsaftte` 9 | #' - `adcm` 10 | #' - `addv` 11 | #' - `adeg` 12 | #' - `adex` 13 | #' - `adlb` 14 | #' - `admh` 15 | #' - `adrs` 16 | #' - `adsub` 17 | #' - `adtte` 18 | #' - `advs` 19 | #' @source based on package `random.cdisc.data` 20 | "syn_data" 21 | 22 | 23 | # ctc_dir ---- 24 | 25 | #' CTC version 4 Grade Direction Data 26 | "ctcv4_dir" 27 | 28 | #' CTC version 5 Grade Direction Data 29 | "ctcv5_dir" 30 | 31 | # mla_grid ---- 32 | #' MLA Grade Direction Data 33 | "mla_dir" 34 | -------------------------------------------------------------------------------- /R/dummy_template.R: -------------------------------------------------------------------------------- 1 | #' Dummy template. 2 | #' 3 | #' This template creates a dummy output. 4 | #' 5 | #' @include chevron_tlg-S4class.R 6 | #' @export 7 | #' 8 | #' @examples 9 | #' run(dummy_template, syn_data) 10 | dummy_template <- chevron_simple() 11 | -------------------------------------------------------------------------------- /R/egt01.R: -------------------------------------------------------------------------------- 1 | # egt01 ---- 2 | 3 | #' @describeIn egt01 Main TLG function 4 | #' 5 | #' @inherit cfbt01_main 6 | #' @include cfbt01.R 7 | #' @returns the main function returns an `rtables` object. 8 | #' 9 | #' @note default precision is 0. 10 | #' 11 | #' @export 12 | #' 13 | egt01_main <- modify_default_args(cfbt01_main, dataset = "adeg", precision = quote(list(default = 0L))) 14 | 15 | #' @describeIn egt01 Preprocessing 16 | #' 17 | #' @inherit cfbt01_pre 18 | #' @returns the preprocessing function returns a `list` of `data.frame`. 19 | #' 20 | #' @export 21 | #' 22 | egt01_pre <- modify_default_args(cfbt01_pre, dataset = "adeg") 23 | 24 | #' `EGT01` ECG Parameters and Change from Baseline By Visit Table. 25 | #' 26 | #' The `EGT01` table provides an 27 | #' overview of the ECG values and its change from baseline of each respective arm 28 | #' over the course of the trial. 29 | #' 30 | #' @include chevron_tlg-S4class.R 31 | #' @export 32 | #' 33 | #' @examples 34 | #' run(egt01, syn_data) 35 | egt01 <- chevron_t( 36 | main = egt01_main, 37 | preprocess = egt01_pre, 38 | postprocess = cfbt01_post, 39 | dataset = c("adsl", "adeg") 40 | ) 41 | -------------------------------------------------------------------------------- /R/lbt15.R: -------------------------------------------------------------------------------- 1 | # lbt15 ---- 2 | 3 | #' @describeIn lbt15 Preprocessing 4 | #' 5 | #' @inheritParams gen_args 6 | #' @returns the preprocessing function returns a `list` of `data.frame`. 7 | #' @export 8 | #' 9 | lbt15_pre <- function(adam_db, ...) { 10 | format <- rule( 11 | "LOW" = c("-3", "-4"), 12 | "MODERATE/NORMAL" = c("-2", "-1", "0", "1", "2"), 13 | "HIGH" = c("3", "4"), 14 | .to_NA = NULL 15 | ) 16 | 17 | adam_db$adlb <- adam_db$adlb %>% 18 | filter( 19 | .data$ONTRTFL == "Y", 20 | .data$PARCAT2 == "SI" 21 | ) %>% 22 | mutate( 23 | PARAM = with_label(.data$PARAM, "Laboratory Test"), 24 | ANRIND = with_label(.data$ANRIND, "Direction of Abnormality") 25 | ) %>% 26 | mutate( 27 | ANRIND = reformat(.data$ATOXGR, .env$format), 28 | BNRIND = reformat(.data$BTOXGR, .env$format) 29 | ) 30 | 31 | adam_db 32 | } 33 | 34 | #' `LBT15` Laboratory Test Shifts to `NCI-CTCAE` Grade 3-4 Post-Baseline Table. 35 | #' @source `lbt04.R` 36 | #' 37 | #' @include chevron_tlg-S4class.R 38 | #' @export 39 | #' 40 | #' @examples 41 | #' run(lbt15, syn_data) 42 | lbt15 <- chevron_t( 43 | main = lbt04_main, 44 | preprocess = lbt15_pre, 45 | postprocess = lbt04_post, 46 | dataset = c("adsl", "adlb") 47 | ) 48 | -------------------------------------------------------------------------------- /R/package.R: -------------------------------------------------------------------------------- 1 | #' `chevron` package 2 | #' 3 | #' @import dplyr 4 | #' @import methods 5 | #' @import rtables 6 | #' @import tern 7 | #' @import checkmate 8 | #' @importFrom formatters with_label propose_column_widths fmt_config 9 | #' @importFrom dunlin rule reformat render_safe assert_all_tablenames get_arg 10 | #' @importFrom forcats fct_relevel 11 | #' @importFrom ggplot2 theme 12 | #' @importFrom grid stringWidth unit 13 | #' @importFrom glue glue 14 | #' @importFrom lifecycle deprecated 15 | #' @importFrom lubridate force_tz 16 | #' @importFrom magrittr %>% 17 | #' @importFrom methods is setValidity 18 | #' @importFrom nestcolor color_palette 19 | #' @importFrom purrr reduce 20 | #' @importFrom rlang sym .data .env !!! %||% abort 21 | #' @importFrom rlistings as_listing 22 | #' @importFrom stats setNames median sd quantile reorder 23 | #' @importFrom stringr str_dup 24 | #' @importFrom tibble tribble 25 | #' @importFrom utils modifyList 26 | "_PACKAGE" 27 | -------------------------------------------------------------------------------- /R/reexports.R: -------------------------------------------------------------------------------- 1 | #' @export 2 | formatters::with_label 3 | #' @export 4 | dunlin::reformat 5 | #' @export 6 | dunlin::get_arg 7 | -------------------------------------------------------------------------------- /R/report_null.R: -------------------------------------------------------------------------------- 1 | #' Creates `NULL` Report 2 | #' 3 | #' @param tlg to convert to null report. 4 | #' @param ind (`integer`) indentation for the outputs of class `VTableTree`. 5 | #' @param ... not used. 6 | #' 7 | #' @rdname report_null 8 | #' @name report_null 9 | #' 10 | #' @returns the `tlg` object or a `NULL` report if the `tlg` is `NULL`, is a `TableTree` with 0 rows, is a `listing_df` 11 | #' with 0 rows or is a `list` with 0 elements. 12 | #' 13 | #' @export 14 | #' @examples 15 | #' report_null(NULL) 16 | setGeneric("report_null", function(tlg, ...) { 17 | standardGeneric("report_null") 18 | }) 19 | 20 | #' @rdname report_null 21 | setMethod("report_null", "NULL", function(tlg, ind = 2L, ...) { 22 | res <- standard_null_report() 23 | table_inset(res) <- ind 24 | res 25 | }) 26 | 27 | #' @rdname report_null 28 | setMethod("report_null", "VTableTree", function(tlg, ind = 2L, ...) { 29 | res <- if (nrow(tlg) == 0L || count_children(tlg) == 0) { 30 | standard_null_report() 31 | } else { 32 | tlg 33 | } 34 | 35 | table_inset(res) <- ind 36 | res 37 | }) 38 | 39 | #' @rdname report_null 40 | setMethod("report_null", "listing_df", function(tlg, ind = 2L, ...) { 41 | if (nrow(tlg) == 0L) { 42 | res <- standard_null_report() 43 | table_inset(res) <- ind 44 | res 45 | } else { 46 | tlg 47 | } 48 | }) 49 | 50 | #' @rdname report_null 51 | setMethod("report_null", "list", function(tlg, ind = 2L, ...) { 52 | if (length(tlg) == 0) { 53 | res <- standard_null_report() 54 | table_inset(res) <- ind 55 | res 56 | } else { 57 | tlg 58 | } 59 | }) 60 | 61 | #' @rdname report_null 62 | setMethod("report_null", "ANY", function(tlg, ...) { 63 | tlg 64 | }) 65 | 66 | #' @export 67 | #' @rdname report_null 68 | standard_null_report <- function() { 69 | rtables::rtable( 70 | header = "", 71 | rrow("", "Null Report: No observations met the reporting criteria for inclusion in this output."), 72 | inset = 2L 73 | ) 74 | } 75 | 76 | #' Standard Post Processing 77 | #' 78 | #' @param tlg to post process. 79 | #' @param ... additional arguments passed to [report_null]. 80 | #' 81 | #' @returns a processed `tlg` or a null report. 82 | #' @export 83 | #' @examples 84 | #' library(rtables) 85 | #' std_postprocessing(build_table(basic_table() |> analyze("Species"), iris), ind = 10L) 86 | #' 87 | std_postprocessing <- function(tlg, ...) { 88 | tlg <- report_null(tlg, ...) 89 | tlg 90 | } 91 | -------------------------------------------------------------------------------- /R/rmpt03.R: -------------------------------------------------------------------------------- 1 | # rmpt03 ---- 2 | 3 | #' @describeIn rmpt03 Main TLG function 4 | #' 5 | #' @inheritParams rmpt01 6 | #' @returns the main function returns an `rtables` object. 7 | #' @details 8 | #' * Person time is the sum of exposure across all patients. 9 | #' * Summary statistics are by default based on the number of patients in the corresponding `N` row 10 | #' (number of non-missing values). 11 | #' * Does not remove zero-count rows unless overridden with `prune_0 = TRUE`. 12 | #' 13 | #' @export 14 | #' 15 | rmpt03_main <- modify_default_args( 16 | rmpt01_main, 17 | summaryvars = "AGEGR1", 18 | col_split_var = "SEX", 19 | overall_col_lbl = "All Genders" 20 | ) 21 | 22 | #' @describeIn rmpt03 Preprocessing 23 | #' 24 | #' @inheritParams gen_args 25 | #' @inheritParams rmpt03_main 26 | #' @returns the preprocessing function returns a `list` of `data.frame`. 27 | #' @export 28 | #' 29 | rmpt03_pre <- modify_default_args( 30 | rmpt01_pre, 31 | summaryvars = "AGEGR1" 32 | ) 33 | 34 | #' `rmpt03`Duration of Exposure for Risk Management Plan Table. 35 | #' 36 | #' The `rmpt03` table provides an overview of duration of exposure. 37 | #' 38 | #' @include chevron_tlg-S4class.R 39 | #' @export 40 | #' 41 | #' @examples 42 | #' pre_data <- dunlin::propagate(syn_data, "adsl", "AGEGR1", "USUBJID") 43 | #' run(rmpt03, pre_data) 44 | rmpt03 <- chevron_t( 45 | main = rmpt03_main, 46 | preprocess = rmpt03_pre, 47 | postprocess = rmpt01_post, 48 | dataset = c("adsl", "adex") 49 | ) 50 | -------------------------------------------------------------------------------- /R/rmpt04.R: -------------------------------------------------------------------------------- 1 | # rmpt04 ---- 2 | 3 | #' @describeIn rmpt04 Main TLG function 4 | #' 5 | #' @inheritParams gen_args 6 | #' @inheritParams rmpt01 7 | #' @returns the main function returns an `rtables` object. 8 | #' 9 | #' @details 10 | #' * Person time is the sum of exposure across all patients. 11 | #' * Summary statistics are by default based on the number of patients in the corresponding `N` row 12 | #' (number of non-missing values). 13 | #' * Does not remove zero-count rows unless overridden with `prune_0 = TRUE`. 14 | #' 15 | #' @export 16 | #' 17 | rmpt04_main <- modify_default_args(rmpt01_main, summaryvars = "ETHNIC") 18 | 19 | #' @describeIn rmpt04 Preprocessing 20 | #' 21 | #' @inheritParams gen_args 22 | #' @inheritParams rmpt04_main 23 | #' @returns the preprocessing function returns a `list` of `data.frame`. 24 | #' @export 25 | #' 26 | rmpt04_pre <- modify_default_args( 27 | rmpt01_pre, 28 | summaryvars = "ETHNIC" 29 | ) 30 | 31 | #' `RMPT04`Extent of Exposure by Ethnic Origin for Risk Management Plan Table. 32 | #' 33 | #' The `RMPT04` table provides an overview of duration of exposure extent. 34 | #' 35 | #' @include chevron_tlg-S4class.R 36 | #' @export 37 | #' 38 | #' @examples 39 | #' run(rmpt04, syn_data) 40 | rmpt04 <- chevron_t( 41 | main = rmpt04_main, 42 | preprocess = rmpt04_pre, 43 | postprocess = rmpt01_post, 44 | dataset = c("adsl", "adex") 45 | ) 46 | -------------------------------------------------------------------------------- /R/rmpt05.R: -------------------------------------------------------------------------------- 1 | # rmpt05 ---- 2 | 3 | #' @describeIn rmpt05 Main TLG function 4 | #' 5 | #' @inheritParams gen_args 6 | #' @inheritParams rmpt01 7 | #' @returns the main function returns an `rtables` object. 8 | #' 9 | #' @details 10 | #' * Person time is the sum of exposure across all patients. 11 | #' * Summary statistics are by default based on the number of patients in the corresponding `N` row 12 | #' (number of non-missing values). 13 | #' * Does not remove zero-count rows unless overridden with `prune_0 = TRUE`. 14 | #' 15 | #' @export 16 | #' 17 | rmpt05_main <- modify_default_args(rmpt01_main, summaryvars = "RACE") 18 | 19 | #' @describeIn rmpt05 Preprocessing 20 | #' 21 | #' @inheritParams gen_args 22 | #' @inheritParams rmpt05_main 23 | #' @returns the preprocessing function returns a `list` of `data.frame`. 24 | #' @export 25 | #' 26 | rmpt05_pre <- modify_default_args( 27 | rmpt01_pre, 28 | summaryvars = "RACE" 29 | ) 30 | 31 | #' `RMPT05` Extent of Exposure by Race for Risk Management Plan Table. 32 | #' 33 | #' The `RMPT05` table provides an overview of duration of exposure extent. 34 | #' 35 | #' @include chevron_tlg-S4class.R 36 | #' @export 37 | #' 38 | #' @examples 39 | #' run(rmpt05, syn_data) 40 | rmpt05 <- chevron_t( 41 | main = rmpt05_main, 42 | preprocess = rmpt05_pre, 43 | postprocess = rmpt01_post, 44 | dataset = c("adsl", "adex") 45 | ) 46 | -------------------------------------------------------------------------------- /R/standard_rules.R: -------------------------------------------------------------------------------- 1 | #' No Coding Available rule 2 | #' @export 3 | nocoding <- rule("No Coding Available" = c("", NA)) 4 | 5 | #' Missing rule 6 | #' @export 7 | missing_rule <- rule("" = c("", NA), .drop = TRUE) 8 | 9 | #' Empty rule 10 | #' @export 11 | empty_rule <- rule(.to_NA = "") 12 | 13 | #' Yes/No rule in title case 14 | #' @export 15 | yes_no_rule <- rule("Yes" = c("Y", "YES", "y", "yes"), "No" = c("N", "NO", "n", "no")) # nolint 16 | 17 | #' Outcome Rule 18 | #' @export 19 | outcome_rule <- rule( 20 | "1" = "FATAL", 21 | "2" = "NOT RECOVERED/NOT RESOLVED", 22 | "3" = "RECOVERED/RESOLVED", 23 | "4" = "RECOVERED/RESOLVED WITH SEQUELAE", 24 | "5" = "RECOVERING/RESOLVING", 25 | "6" = "UNKNOWN" 26 | ) 27 | 28 | #' Dose Change Rule 29 | #' @export 30 | dose_change_rule <- rule( 31 | "1" = "DOSE INCREASED", 32 | "2" = "DOSE NOT CHANGED", 33 | "3" = c("DOSE REDUCED", "DOSE RATE REDUCED"), 34 | "4" = "DRUG INTERRUPTED", 35 | "5" = "DRUG WITHDRAWN", 36 | "6" = c("NOT APPLICABLE", "NOT EVALUABLE"), 37 | "7" = "UNKNOWN" 38 | ) 39 | 40 | #' Get grade rule 41 | #' @param direction (`string`) of abnormality direction. 42 | #' @param missing (`string`) method to deal with missing 43 | #' @returns a `rule` object. 44 | #' @export 45 | get_grade_rule <- function(direction = "high", missing = "incl") { 46 | assert_choice(direction, c("high", "low")) 47 | assert_choice(missing, c("incl", "gr_0", "excl")) 48 | rule_arg <- list() 49 | if (direction == "high") { 50 | rule_arg[["Not High"]] <- c("0", "-1", "-2", "-3", "-4") 51 | rule_arg[as.character(1:4)] <- as.character(1:4) 52 | } else { 53 | rule_arg[["Not Low"]] <- c("0", "1", "2", "3", "4") 54 | rule_arg[as.character(1:4)] <- as.character(-1:-4) 55 | } 56 | if (missing == "incl") { 57 | rule_arg$Missing <- c(NA, "", "") 58 | } else if (missing == "gr_0") { 59 | rule_arg[[1]] <- c(rule_arg[[1]], NA, "") 60 | } 61 | rule(.lst = rule_arg) 62 | } 63 | -------------------------------------------------------------------------------- /R/unwrap.R: -------------------------------------------------------------------------------- 1 | #' Helper Function Extracting Layout Functions 2 | #' @keywords internal 3 | #' 4 | h_unwrap_layout <- function(x, pattern) { 5 | assert_string(pattern) 6 | 7 | # If x is a list or a call, apply the function on each element 8 | if (inherits(x, c("list", "call", "<-", "if"))) { 9 | lapply(x, \(x) h_unwrap_layout(x, pattern)) 10 | } else if (is(x, "name")) { 11 | # Return if name match pattern. 12 | 13 | if (grepl(pattern, x)) { 14 | res <- list(x) 15 | names(res) <- as.character(x) 16 | res 17 | } else { 18 | NULL 19 | } 20 | } else { 21 | NULL 22 | } 23 | } 24 | 25 | #' Extracting Layout Function. 26 | #' 27 | #' @param x (`function`) containing a call to a layout function. 28 | #' @param pattern (`string`) identifying layout functions 29 | #' 30 | #' @returns invisible `NULL` and print the content of the layout functions found in the body of `x`. 31 | #' 32 | #' @export 33 | #' @keywords internal 34 | #' @examples 35 | #' unwrap_layout(aet01_main) 36 | #' 37 | unwrap_layout <- function(x, pattern = "_lyt$") { 38 | checkmate::assert_function(x) 39 | checkmate::assert_string(pattern) 40 | 41 | # Identify environment of the parent function. 42 | env_x <- tryCatch( 43 | rlang::get_env(x), 44 | error = function(e) NULL 45 | ) 46 | 47 | # Get the associated layout functions as name objects 48 | res <- unlist(h_unwrap_layout(body(x)[-1], pattern)) 49 | 50 | if (length(res) > 0L) { 51 | cat("Layout function:") 52 | purrr::lmap( 53 | res, 54 | function(x) { 55 | # Evaluate layout function symbol in the environment of the parent function. 56 | tryCatch( 57 | { 58 | cat("\n") 59 | layout_code <- paste(deparse(eval(x[[1]], envir = env_x)), collapse = "\n") 60 | cat(sprintf(" %s:\n", names(x))) 61 | cat(layout_code) 62 | }, 63 | error = function(e) cat("\n Unable to print layout function!") 64 | ) 65 | 66 | list() 67 | } 68 | ) 69 | } 70 | cat("\n") 71 | invisible(NULL) 72 | } 73 | -------------------------------------------------------------------------------- /R/vst01.R: -------------------------------------------------------------------------------- 1 | # vst01 ---- 2 | 3 | #' @describeIn vst01 Main TLG function 4 | #' 5 | #' @inherit cfbt01_main 6 | #' @include cfbt01.R 7 | #' @returns the main function returns an `rtables` object. 8 | #' 9 | #' @export 10 | #' 11 | vst01_main <- modify_default_args( 12 | cfbt01_main, 13 | dataset = "advs", 14 | precision = quote(list(DIABP = 0, PUL = 0, SYSBP = 0, default = 2L)) 15 | ) 16 | 17 | #' @describeIn vst01 Preprocessing 18 | #' 19 | #' @inherit cfbt01_pre 20 | #' @returns the preprocessing function returns a `list` of `data.frame`. 21 | #' @export 22 | #' 23 | vst01_pre <- modify_default_args( 24 | cfbt01_pre, 25 | dataset = "advs" 26 | ) 27 | 28 | #' `VST01` Vital Sign Results and change from Baseline By Visit Table. 29 | #' 30 | #' The `VST01` table provides an 31 | #' overview of the Vital Sign values and its change from baseline of each respective arm 32 | #' over the course of the trial. 33 | #' 34 | #' @include chevron_tlg-S4class.R 35 | #' @export 36 | #' 37 | #' @examples 38 | #' library(dunlin) 39 | #' 40 | #' proc_data <- log_filter( 41 | #' syn_data, 42 | #' PARAMCD %in% c("DIABP", "SYSBP"), "advs" 43 | #' ) 44 | #' run(vst01, proc_data) 45 | vst01 <- chevron_t( 46 | main = vst01_main, 47 | preprocess = vst01_pre, 48 | postprocess = cfbt01_post, 49 | dataset = c("adsl", "advs") 50 | ) 51 | -------------------------------------------------------------------------------- /R/zzz.R: -------------------------------------------------------------------------------- 1 | .onLoad <- function(libname, pkgname) { 2 | tern::set_default_na_str("NE") 3 | } 4 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting Security Issues 4 | 5 | If you believe you have found a security vulnerability in any of the repositories in this organization, please report it to us through coordinated disclosure. 6 | 7 | **Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.** 8 | 9 | Instead, please send an email to vulnerability.management[@]roche.com. 10 | 11 | Please include as much of the information listed below as you can to help us better understand and resolve the issue: 12 | 13 | * The type of issue (e.g., buffer overflow, SQL injection, or cross-site scripting) 14 | * Full paths of source file(s) related to the manifestation of the issue 15 | * The location of the affected source code (tag/branch/commit or direct URL) 16 | * Any special configuration required to reproduce the issue 17 | * Step-by-step instructions to reproduce the issue 18 | * Proof-of-concept or exploit code (if possible) 19 | * Impact of the issue, including how an attacker might exploit the issue 20 | 21 | This information will help us triage your report more quickly. 22 | 23 | ## Data Security Standards (DSS) 24 | 25 | Please make sure that while reporting issues in the form a bug, feature, or pull request, *all* sensitive information such as [PII](https://www.dhs.gov/privacy-training/what-personally-identifiable-information), [PHI](https://www.hhs.gov/hipaa/for-professionals/security/laws-regulations/index.html), and [PCI](https://www.pcisecuritystandards.org/pci_security/standards_overview) is completely removed from any text and attachments, including pictures and videos. 26 | -------------------------------------------------------------------------------- /chevron.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | ProjectId: 9fd9da5a-14c0-440f-9916-f34865af547d 3 | 4 | RestoreWorkspace: Default 5 | SaveWorkspace: Default 6 | AlwaysSaveHistory: Default 7 | 8 | EnableCodeIndexing: Yes 9 | UseSpacesForTab: Yes 10 | NumSpacesForTab: 2 11 | Encoding: UTF-8 12 | 13 | RnwWeave: Sweave 14 | LaTeX: pdfLaTeX 15 | 16 | AutoAppendNewline: Yes 17 | StripTrailingWhitespace: Yes 18 | 19 | BuildType: Package 20 | PackageUseDevtools: Yes 21 | PackageInstallArgs: --no-multiarch --with-keep.source 22 | PackageRoxygenize: rd,collate,namespace 23 | -------------------------------------------------------------------------------- /data-raw/grade_dir.R: -------------------------------------------------------------------------------- 1 | ctc_dir <- read.csv("inst/extdata/ctcdir.csv") 2 | ctcv4_dir <- subset(ctc_dir, CTCv == 4) 3 | ctcv5_dir <- subset(ctc_dir, CTCv == 4) 4 | 5 | mla_dir <- read.csv("inst/extdata/mladir.csv") 6 | 7 | usethis::use_data(ctcv4_dir, ctcv5_dir, mla_dir, overwrite = TRUE) 8 | -------------------------------------------------------------------------------- /data/ctcv4_dir.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insightsengineering/chevron/f7465dfbb34fb28fc7881f2d072b9943a921f19c/data/ctcv4_dir.rda -------------------------------------------------------------------------------- /data/ctcv5_dir.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insightsengineering/chevron/f7465dfbb34fb28fc7881f2d072b9943a921f19c/data/ctcv5_dir.rda -------------------------------------------------------------------------------- /data/mla_dir.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insightsengineering/chevron/f7465dfbb34fb28fc7881f2d072b9943a921f19c/data/mla_dir.rda -------------------------------------------------------------------------------- /data/syn_data.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/insightsengineering/chevron/f7465dfbb34fb28fc7881f2d072b9943a921f19c/data/syn_data.rda -------------------------------------------------------------------------------- /inst/WORDLIST: -------------------------------------------------------------------------------- 1 | ADaMIG 2 | Agresti 3 | CTC 4 | Clopper 5 | Coull 6 | Forkers 7 | Haenszel 8 | Hauck 9 | Hoffmann 10 | Jeffreys 11 | Kaplan 12 | MLA 13 | MedDRA 14 | Newcombe 15 | ORCID 16 | Postprocessing 17 | Pre 18 | Schouten 19 | TLG 20 | TLGs 21 | Unstratified 22 | dunlin 23 | funder 24 | postprocessing 25 | pre 26 | preprocess 27 | responder 28 | responders 29 | rtables 30 | unstratified 31 | -------------------------------------------------------------------------------- /inst/extdata/ctcdir.csv: -------------------------------------------------------------------------------- 1 | "PARAMCD","GRADE_DIR","CTCv" 2 | "ALBUMSI","LOW",5 3 | "ALKPHSI","HIGH",5 4 | "ALTSI","HIGH",5 5 | "AMYLASSI","HIGH",5 6 | "APTTSI","HIGH",5 7 | "ASTSI","HIGH",5 8 | "CALCUMSI","B",5 9 | "CD4SI","LOW",5 10 | "CH0022SI","B",5 11 | "CH0350SI","HIGH",5 12 | "CH0365SI","HIGH",5 13 | "CH0467SI","HIGH",5 14 | "CHOLESSI","HIGH",5 15 | "CPKSI","HIGH",5 16 | "CREATNSI","HIGH",5 17 | "FASTGLSI","LOW",5 18 | "FIBSI","LOW",5 19 | "GGTSI","HIGH",5 20 | "GLUCSI","LOW",5 21 | "HGBSI","B",5 22 | "HPTSI","LOW",5 23 | "LIPASESI","HIGH",5 24 | "LYMPHSI","B",5 25 | "MAGNESSI","B",5 26 | "NEUTRSI","LOW",5 27 | "PLATESI","LOW",5 28 | "POTASSI","B",5 29 | "PTINRSI","HIGH",5 30 | "PTTSI","HIGH",5 31 | "SODIUMSI","B",5 32 | "TBILISI","HIGH",5 33 | "TRIGSI","HIGH",5 34 | "URACIDSI","HIGH",5 35 | "WBCSI","B",5 36 | "ALBUMSI","LOW",4 37 | "ALKPHSI","HIGH",4 38 | "ALTSI","HIGH",4 39 | "AMYLASSI","HIGH",4 40 | "APTTSI","HIGH",4 41 | "ASTSI","HIGH",4 42 | "CALCUMSI","B",4 43 | "CD4SI","LOW",4 44 | "CH0022SI","B",4 45 | "CH0350SI","HIGH",4 46 | "CH0365SI","HIGH",4 47 | "CH0467SI","HIGH",4 48 | "CHOLESSI","HIGH",4 49 | "CPKSI","HIGH",4 50 | "CREATNSI","HIGH",4 51 | "FASTGLSI","B",4 52 | "FIBSI","LOW",4 53 | "GGTSI","HIGH",4 54 | "GLUCSI","B",4 55 | "HGBSI","B",4 56 | "HPTSI","LOW",4 57 | "LIPASESI","HIGH",4 58 | "LYMPHSI","B",4 59 | "MAGNESSI","B",4 60 | "NEUTRSI","LOW",4 61 | "PHOSATSI","LOW",4 62 | "PLATESI","LOW",4 63 | "POTASSI","B",4 64 | "PTINRSI","HIGH",4 65 | "PTTSI","HIGH",4 66 | "SODIUMSI","B",4 67 | "TBILISI","HIGH",4 68 | "TRIGSI","HIGH",4 69 | "URACIDSI","HIGH",4 70 | "WBCSI","B",4 71 | -------------------------------------------------------------------------------- /inst/extdata/mladir.csv: -------------------------------------------------------------------------------- 1 | "PARAMCD","GRADE_DIR" 2 | "ALBUMLS","LOW" 3 | "ALKPHLS","HIGH" 4 | "ALTLS","HIGH" 5 | "APTTLS","HIGH" 6 | "ASTLS","HIGH" 7 | "BANDSFLS","HIGH" 8 | "BANDSLS","HIGH" 9 | "BASOSFLS","HIGH" 10 | "BASOSLS","HIGH" 11 | "BICARBLS","LOW" 12 | "BICARBLS","HIGH" 13 | "BUNLS","HIGH" 14 | "CALCUMLS","LOW" 15 | "CALCUMLS","HIGH" 16 | "CHLORLS","LOW" 17 | "CHLORLS","HIGH" 18 | "CHOLESLS","HIGH" 19 | "CPKLS","HIGH" 20 | "CPKMBLS","HIGH" 21 | "CREATNLS","HIGH" 22 | "DBILILS","HIGH" 23 | "EOSINFLS","HIGH" 24 | "EOSINLS","HIGH" 25 | "FASTGLLS","LOW" 26 | "FASTGLLS","HIGH" 27 | "FIBLS","LOW" 28 | "GGTLS","HIGH" 29 | "HCRITLS","LOW" 30 | "HCRITLS","HIGH" 31 | "HDLLS","LOW" 32 | "HGBLS","LOW" 33 | "HGBLS","HIGH" 34 | "LDHLS","HIGH" 35 | "LDLLS","HIGH" 36 | "LYMPHFLS","LOW" 37 | "LYMPHFLS","HIGH" 38 | "LYMPHLS","LOW" 39 | "LYMPHLS","HIGH" 40 | "MCHCLS","LOW" 41 | "MCHCLS","HIGH" 42 | "MCHLS","LOW" 43 | "MCHLS","HIGH" 44 | "MCVLS","LOW" 45 | "MCVLS","HIGH" 46 | "MONOSFLS","HIGH" 47 | "MONOSLS","HIGH" 48 | "NEUTRFLS","LOW" 49 | "NEUTRFLS","HIGH" 50 | "NEUTRLS","LOW" 51 | "NEUTRLS","HIGH" 52 | "PHOSATLS","LOW" 53 | "PHOSATLS","HIGH" 54 | "PLATELS","LOW" 55 | "PLATELS","HIGH" 56 | "POTASLS","LOW" 57 | "POTASLS","HIGH" 58 | "PTINRLS","HIGH" 59 | "PTTLS","HIGH" 60 | "RBCLS","LOW" 61 | "RBCLS","HIGH" 62 | "SODIUMLS","LOW" 63 | "SODIUMLS","HIGH" 64 | "T3LS","LOW" 65 | "T3LS","HIGH" 66 | "T4FREELS","LOW" 67 | "T4FREELS","HIGH" 68 | "T4LS","LOW" 69 | "T4LS","HIGH" 70 | "TBILILS","HIGH" 71 | "TPROTLS","LOW" 72 | "TPROTLS","HIGH" 73 | "TRIGLS","HIGH" 74 | "TSHLS","HIGH" 75 | "URACIDLS","HIGH" 76 | "WBCLS","LOW" 77 | "WBCLS","HIGH" 78 | -------------------------------------------------------------------------------- /man/ael02.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ael02.R 3 | \docType{data} 4 | \name{ael02_main} 5 | \alias{ael02_main} 6 | \alias{ael02_pre} 7 | \alias{ael02} 8 | \title{\code{AEL02} Listing 1 (Default) Listing of Adverse Events.} 9 | \format{ 10 | An object of class \code{chevron_l} of length 1. 11 | } 12 | \usage{ 13 | ael02_main( 14 | adam_db, 15 | dataset = "adae", 16 | key_cols = c("ID", "ASR"), 17 | disp_cols = c("AEDECOD", "TRTSDTM", "ASTDY", "ADURN", "AESER", "ASEV", "AREL", "AEOUT", 18 | "AECONTRT", "AEACN"), 19 | split_into_pages_by_var = "ACTARM", 20 | unique_rows = FALSE, 21 | ... 22 | ) 23 | 24 | ael02_pre(adam_db, dataset = "adae", arm_var = "ACTARM", ...) 25 | 26 | ael02 27 | } 28 | \arguments{ 29 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 30 | 31 | \item{dataset}{(\code{string}) the name of a table in the \code{adam_db} object.} 32 | 33 | \item{key_cols}{(\code{character}) names of columns that should be treated as key columns when rendering the listing. 34 | Key columns allow you to group repeat occurrences.} 35 | 36 | \item{disp_cols}{(\code{character}) names of non-key columns which should be displayed when the listing is rendered.} 37 | 38 | \item{split_into_pages_by_var}{(\code{character} or \code{NULL}) the name of the variable to split the listing by.} 39 | 40 | \item{unique_rows}{(\code{flag}) whether to keep only unique rows in listing.} 41 | 42 | \item{...}{not used.} 43 | 44 | \item{arm_var}{(\code{string}) variable used for column splitting} 45 | } 46 | \value{ 47 | the main function returns an \code{rlistings} or a \code{list} object. 48 | 49 | the preprocessing function returns a \code{list} of \code{data.frame}. 50 | } 51 | \description{ 52 | \code{AEL02} Listing 1 (Default) Listing of Adverse Events. 53 | } 54 | \section{Functions}{ 55 | \itemize{ 56 | \item \code{ael02_main()}: Main TLG function 57 | 58 | \item \code{ael02_pre()}: Preprocessing 59 | 60 | }} 61 | \examples{ 62 | res <- run(ael02, syn_data) 63 | } 64 | \keyword{datasets} 65 | -------------------------------------------------------------------------------- /man/ael03.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ael03.R 3 | \docType{data} 4 | \name{ael03_main} 5 | \alias{ael03_main} 6 | \alias{ael03_pre} 7 | \alias{ael03} 8 | \title{\code{AEL03} Listing 1 (Default) Listing of Serious Adverse Events.} 9 | \format{ 10 | An object of class \code{chevron_l} of length 1. 11 | } 12 | \usage{ 13 | ael03_main( 14 | adam_db, 15 | dataset = "adae", 16 | key_cols = c("ID", "ASR"), 17 | disp_cols = c("AEDECOD", "TRTSDTM", "ASTDY", "ADURN", "ASEV", "AREL", "AEOUT", 18 | "AECONTRT", "AEACN", "SERREAS"), 19 | split_into_pages_by_var = "ACTARM", 20 | unique_rows = FALSE, 21 | ... 22 | ) 23 | 24 | ael03_pre(adam_db, dataset = "adae", arm_var = "ACTARM", ...) 25 | 26 | ael03 27 | } 28 | \arguments{ 29 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 30 | 31 | \item{dataset}{(\code{string}) the name of a table in the \code{adam_db} object.} 32 | 33 | \item{key_cols}{(\code{character}) names of columns that should be treated as key columns when rendering the listing. 34 | Key columns allow you to group repeat occurrences.} 35 | 36 | \item{disp_cols}{(\code{character}) names of non-key columns which should be displayed when the listing is rendered.} 37 | 38 | \item{split_into_pages_by_var}{(\code{character} or \code{NULL}) the name of the variable to split the listing by.} 39 | 40 | \item{unique_rows}{(\code{flag}) whether to keep only unique rows in listing.} 41 | 42 | \item{...}{not used.} 43 | 44 | \item{arm_var}{(\code{string}) variable used for column splitting} 45 | } 46 | \value{ 47 | the main function returns an \code{rlistings} or a \code{list} object. 48 | } 49 | \description{ 50 | \code{AEL03} Listing 1 (Default) Listing of Serious Adverse Events. 51 | } 52 | \section{Functions}{ 53 | \itemize{ 54 | \item \code{ael03_main()}: Main TLG function 55 | 56 | \item \code{ael03_pre()}: Preprocessing 57 | 58 | }} 59 | \examples{ 60 | res <- run(ael03, syn_data) 61 | } 62 | \keyword{datasets} 63 | -------------------------------------------------------------------------------- /man/aet01_aesi_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aet01_aesi.R 3 | \name{aet01_aesi_lyt} 4 | \alias{aet01_aesi_lyt} 5 | \title{\code{aet01_aesi} Layout} 6 | \usage{ 7 | aet01_aesi_lyt(arm_var, aesi_vars, lbl_overall, lbl_aesi_vars, grade_groups) 8 | } 9 | \arguments{ 10 | \item{arm_var}{(\code{string}) variable used for column splitting} 11 | 12 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 13 | 14 | \item{lbl_aesi_vars}{(\code{character}) the labels of the \code{AESI} variables to be summarized.} 15 | } 16 | \value{ 17 | a \code{PreDataTableLayouts} object. 18 | } 19 | \description{ 20 | \code{aet01_aesi} Layout 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/aet01_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aet01.R 3 | \name{aet01_lyt} 4 | \alias{aet01_lyt} 5 | \title{\code{aet01} Layout} 6 | \usage{ 7 | aet01_lyt(arm_var, lbl_overall, anl_vars, anl_lbls, lbl_vars) 8 | } 9 | \arguments{ 10 | \item{arm_var}{(\code{string}) variable used for column splitting} 11 | 12 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 13 | 14 | \item{anl_vars}{Named (\code{list}) of analysis variables.} 15 | 16 | \item{anl_lbls}{(\code{character}) of labels.} 17 | 18 | \item{lbl_vars}{Named (\code{list}) of analysis labels.} 19 | } 20 | \value{ 21 | a \code{PreDataTableLayouts} object. 22 | } 23 | \description{ 24 | \code{aet01} Layout 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/aet03.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aet03.R 3 | \docType{data} 4 | \name{aet03_main} 5 | \alias{aet03_main} 6 | \alias{aet03_pre} 7 | \alias{aet03_post} 8 | \alias{aet03} 9 | \title{\code{AET03} Table 1 (Default) Advert Events by Greatest Intensity Table 1.} 10 | \format{ 11 | An object of class \code{chevron_t} of length 1. 12 | } 13 | \usage{ 14 | aet03_main(adam_db, arm_var = "ACTARM", lbl_overall = NULL, ...) 15 | 16 | aet03_pre(adam_db, ...) 17 | 18 | aet03_post(tlg, prune_0 = TRUE, ...) 19 | 20 | aet03 21 | } 22 | \arguments{ 23 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 24 | 25 | \item{arm_var}{(\code{string}) variable used for column splitting} 26 | 27 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 28 | 29 | \item{...}{not used.} 30 | 31 | \item{tlg}{(\code{TableTree}, \code{Listing} or \code{ggplot}) object typically produced by a \code{main} function.} 32 | 33 | \item{prune_0}{(\code{flag}) remove 0 count rows} 34 | } 35 | \value{ 36 | the main function returns an \code{rtables} object. 37 | 38 | the preprocessing function returns a \code{list} of \code{data.frame}. 39 | 40 | the postprocessing function returns an \code{rtables} object or an \code{ElementaryTable} (null report). 41 | } 42 | \description{ 43 | An adverse events table categorized by System 44 | Organ Class, Dictionary-Derived Term and Greatest intensity. 45 | } 46 | \details{ 47 | \itemize{ 48 | \item Default Adverse Events by Greatest Intensity table. 49 | \item Numbers represent absolute numbers of patients and fraction of \code{N}. 50 | \item Remove zero-count rows unless overridden with \code{prune_0 = FALSE}. 51 | \item Split columns by arm. 52 | \item Does not include a total column by default. 53 | \item Sort by Body System or Organ Class (\code{SOC}) and Dictionary-Derived Term (\code{PT}). 54 | } 55 | } 56 | \section{Functions}{ 57 | \itemize{ 58 | \item \code{aet03_main()}: Main TLG function 59 | 60 | \item \code{aet03_pre()}: Preprocessing 61 | 62 | \item \code{aet03_post()}: Postprocessing 63 | 64 | }} 65 | \note{ 66 | \itemize{ 67 | \item \code{adam_db} object must contain an \code{adae} table with the columns \code{"AEBODSYS"}, \code{"AEDECOD"} and \code{"ASEV"}. 68 | } 69 | } 70 | \examples{ 71 | run(aet03, syn_data) 72 | } 73 | \keyword{datasets} 74 | -------------------------------------------------------------------------------- /man/aet03_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aet03.R 3 | \name{aet03_lyt} 4 | \alias{aet03_lyt} 5 | \title{\code{aet03} Layout} 6 | \usage{ 7 | aet03_lyt(arm_var, lbl_overall, lbl_aebodsys, lbl_aedecod, intensity_grade) 8 | } 9 | \arguments{ 10 | \item{arm_var}{(\code{string}) variable used for column splitting} 11 | 12 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 13 | 14 | \item{lbl_aebodsys}{(\code{string}) text label for \code{AEBODSYS}.} 15 | 16 | \item{lbl_aedecod}{(\code{string}) text label for \code{AEDECOD}.} 17 | 18 | \item{intensity_grade}{(\code{character}) describing the intensity levels present in the dataset.} 19 | } 20 | \value{ 21 | a \code{PreDataTableLayouts} object. 22 | } 23 | \description{ 24 | \code{aet03} Layout 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/aet04_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aet04.R 3 | \name{aet04_lyt} 4 | \alias{aet04_lyt} 5 | \title{\code{aet04} Layout} 6 | \usage{ 7 | aet04_lyt( 8 | arm_var, 9 | total_var, 10 | lbl_overall, 11 | lbl_aebodsys, 12 | lbl_aedecod, 13 | grade_groups 14 | ) 15 | } 16 | \arguments{ 17 | \item{arm_var}{(\code{string}) variable used for column splitting} 18 | 19 | \item{total_var}{(\code{string}) variable to create summary of all variables.} 20 | 21 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 22 | 23 | \item{lbl_aebodsys}{(\code{string}) text label for \code{AEBODSYS}.} 24 | 25 | \item{lbl_aedecod}{(\code{string}) text label for \code{AEDECOD}.} 26 | 27 | \item{grade_groups}{(\code{list}) putting in correspondence toxicity grades and labels.} 28 | } 29 | \value{ 30 | a \code{PreDataTableLayouts} object. 31 | } 32 | \description{ 33 | \code{aet04} Layout 34 | } 35 | \keyword{internal} 36 | -------------------------------------------------------------------------------- /man/aet05_all.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aet05_all.R 3 | \docType{data} 4 | \name{aet05_all_pre} 5 | \alias{aet05_all_pre} 6 | \alias{aet05_all} 7 | \title{\code{AET05_ALL} Table 1 (Default) Adverse Event Rate Adjusted for Patient-Years at Risk - All Occurrences.} 8 | \format{ 9 | An object of class \code{chevron_t} of length 1. 10 | } 11 | \usage{ 12 | aet05_all_pre(adam_db, dataset = "adsaftte", ...) 13 | 14 | aet05_all 15 | } 16 | \arguments{ 17 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 18 | 19 | \item{dataset}{(\code{string}) the name of a table in the \code{adam_db} object.} 20 | 21 | \item{...}{not used.} 22 | } 23 | \value{ 24 | the preprocessing function returns a \code{list} of \code{data.frame}. 25 | } 26 | \description{ 27 | The \code{AET05_ALL} table produces the standard adverse event rate adjusted for patient-years at risk summary 28 | considering all occurrences. 29 | } 30 | \section{Functions}{ 31 | \itemize{ 32 | \item \code{aet05_all_pre()}: Preprocessing 33 | 34 | }} 35 | \examples{ 36 | library(dplyr) 37 | library(dunlin) 38 | 39 | proc_data <- log_filter(syn_data, PARAMCD == "AETOT1" | PARAMCD == "AEREPTTE", "adsaftte") 40 | 41 | run(aet05_all, proc_data) 42 | 43 | run(aet05_all, proc_data, conf_level = 0.90, conf_type = "exact") 44 | } 45 | \keyword{datasets} 46 | -------------------------------------------------------------------------------- /man/aet05_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aet05.R 3 | \name{aet05_lyt} 4 | \alias{aet05_lyt} 5 | \title{\code{aet05} Layout} 6 | \usage{ 7 | aet05_lyt(arm_var, lbl_overall, param_label, vars, n_events, control) 8 | } 9 | \arguments{ 10 | \item{arm_var}{(\code{string}) variable used for column splitting} 11 | 12 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 13 | 14 | \item{param_label}{(\code{string}) variable for parameter code.} 15 | 16 | \item{vars}{(\code{string}) variable for the primary analysis variable to be iterated over.} 17 | 18 | \item{n_events}{(\code{string}) variable to count the number of events observed.} 19 | 20 | \item{control}{(\code{list}) parameters for estimation details, specified by using the helper function 21 | control_incidence_rate().} 22 | } 23 | \value{ 24 | a \code{PreDataTableLayouts} object. 25 | } 26 | \description{ 27 | \code{aet05} Layout 28 | } 29 | \keyword{internal} 30 | -------------------------------------------------------------------------------- /man/aet10_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/aet10.R 3 | \name{aet10_lyt} 4 | \alias{aet10_lyt} 5 | \title{\code{aet10} Layout} 6 | \usage{ 7 | aet10_lyt(arm_var, lbl_overall, lbl_aedecod) 8 | } 9 | \arguments{ 10 | \item{arm_var}{(\code{string}) variable used for column splitting} 11 | 12 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 13 | 14 | \item{lbl_aedecod}{(\code{character}) text label for \code{AEDECOD}.} 15 | } 16 | \value{ 17 | a \code{PreDataTableLayouts} object. 18 | } 19 | \description{ 20 | \code{aet10} Layout 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/afun_p.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{afun_p} 4 | \alias{afun_p} 5 | \title{Analyze with defined precision} 6 | \usage{ 7 | afun_p( 8 | x, 9 | .N_col, 10 | .spl_context, 11 | precision, 12 | .N_row, 13 | .var = NULL, 14 | .df_row = NULL, 15 | .stats = NULL, 16 | .labels = NULL, 17 | .indent_mods = NULL, 18 | ... 19 | ) 20 | } 21 | \arguments{ 22 | \item{x}{value to analyze} 23 | 24 | \item{.N_col}{(\code{int}) See \code{tern::analyze_variables}.} 25 | 26 | \item{.spl_context}{split context.} 27 | 28 | \item{precision}{(named \code{list} of \code{integer}) where names of columns found in \code{.df_row} and the values indicate the 29 | number of digits in statistics for numeric value. If \code{default} is set, and parameter precision not specified, the 30 | value for \code{default} will be used. If neither are provided, auto determination is used. See \code{\link[tern:format_auto]{tern::format_auto}}.} 31 | 32 | \item{.N_row}{(\code{int}) See \code{tern::analyze_variables}.} 33 | 34 | \item{.var}{variable name.} 35 | 36 | \item{.stats}{(named \code{list} of character) where names of columns found in \code{.df_row} and the values indicate the 37 | statistical analysis to perform. If \code{default} is set, and parameter precision not specified, the 38 | value for \code{default} will be used.} 39 | 40 | \item{.labels}{(\code{character}) See \code{tern::analyze_variables}.} 41 | 42 | \item{.indent_mods}{(\code{integer}) See \code{tern::analyze_variables}.} 43 | 44 | \item{...}{additional arguments for \code{tern::a_summary}.} 45 | } 46 | \description{ 47 | Analyze with defined precision 48 | } 49 | \keyword{internal} 50 | -------------------------------------------------------------------------------- /man/afun_skip.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{afun_skip} 4 | \alias{afun_skip} 5 | \title{Analyze skip baseline} 6 | \usage{ 7 | afun_skip( 8 | x, 9 | .var, 10 | .spl_context, 11 | paramcdvar, 12 | visitvar, 13 | skip, 14 | precision, 15 | .stats, 16 | .labels = NULL, 17 | .indent_mods = NULL, 18 | .N_col, 19 | .N_row, 20 | ... 21 | ) 22 | } 23 | \arguments{ 24 | \item{x}{value to analyze} 25 | 26 | \item{.var}{variable name.} 27 | 28 | \item{.spl_context}{split context.} 29 | 30 | \item{paramcdvar}{(\code{string}) name of parameter code.} 31 | 32 | \item{visitvar}{(\code{string}) name of the visit variable.} 33 | 34 | \item{skip}{Named (\code{character}) indicating the pairs to skip in analyze.} 35 | 36 | \item{precision}{(named \code{list} of \code{integer}) where names are values found in the \code{PARAMCD} column and the values 37 | indicate the number of digits in statistics. If \code{default} is set, and parameter precision not specified, 38 | the value for \code{default} will be used. If \code{default} is not set, the default precision is 2.} 39 | 40 | \item{.stats}{(\code{character}) See \code{tern::analyze_variables}.} 41 | 42 | \item{.labels}{(\code{character}) See \code{tern::analyze_variables}.} 43 | 44 | \item{.indent_mods}{(\code{integer}) See \code{tern::analyze_variables}.} 45 | 46 | \item{.N_col}{(\code{int}) See \code{tern::analyze_variables}.} 47 | 48 | \item{.N_row}{(\code{int}) See \code{tern::analyze_variables}.} 49 | 50 | \item{...}{additional arguments for \code{tern::a_summary}.} 51 | } 52 | \description{ 53 | Analyze skip baseline 54 | } 55 | \keyword{internal} 56 | -------------------------------------------------------------------------------- /man/args_ls.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/chevron_tlg-S4methods.R 3 | \name{args_ls} 4 | \alias{args_ls} 5 | \alias{args_ls,chevron_tlg-method} 6 | \title{Get Arguments List} 7 | \usage{ 8 | args_ls(x, simplify = FALSE, omit = NULL) 9 | 10 | \S4method{args_ls}{chevron_tlg}(x, simplify = FALSE, omit = NULL) 11 | } 12 | \arguments{ 13 | \item{x}{(\code{chevron_tlg}) input.} 14 | 15 | \item{simplify}{(\code{flag}) whether to simplify the output, coalescing the values of the parameters. The order of 16 | priority for the value of the parameters is: \code{main}, \code{preprocess} and \code{postprocess}.} 17 | 18 | \item{omit}{(\code{character}) the names of the argument to omit from the output.} 19 | } 20 | \value{ 21 | a \code{list} of the formal arguments with their default for the functions stored in the \code{chevron_tlg} object 22 | passed a \code{x} argument. 23 | } 24 | \description{ 25 | Get Arguments List 26 | } 27 | \examples{ 28 | args_ls(aet01, simplify = TRUE) 29 | } 30 | -------------------------------------------------------------------------------- /man/assert_single_value.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/assertions.R 3 | \name{assert_single_value} 4 | \alias{assert_single_value} 5 | \title{Check variable only has one unique value.} 6 | \usage{ 7 | assert_single_value(x, label = deparse(substitute(x))) 8 | } 9 | \arguments{ 10 | \item{x}{value vector.} 11 | 12 | \item{label}{(\code{string}) label of input.} 13 | } 14 | \value{ 15 | invisible \code{NULL} or an error message if the criteria are not fulfilled. 16 | } 17 | \description{ 18 | Check variable only has one unique value. 19 | } 20 | -------------------------------------------------------------------------------- /man/assert_valid_type.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/assertions.R 3 | \name{assert_valid_type} 4 | \alias{assert_valid_type} 5 | \title{Check variable is of correct type} 6 | \usage{ 7 | assert_valid_type(x, types, label = deparse(substitute(x))) 8 | } 9 | \arguments{ 10 | \item{x}{Object to check the type.} 11 | 12 | \item{types}{(\code{character}) possible types to check.} 13 | 14 | \item{label}{(\code{string}) label.} 15 | } 16 | \value{ 17 | invisible \code{NULL} or an error message if the criteria are not fulfilled. 18 | } 19 | \description{ 20 | Check variable is of correct type 21 | } 22 | -------------------------------------------------------------------------------- /man/assert_valid_var.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/assertions.R 3 | \name{assert_valid_var} 4 | \alias{assert_valid_var} 5 | \alias{assert_valid_var.character} 6 | \alias{assert_valid_var.factor} 7 | \alias{assert_valid_var.logical} 8 | \alias{assert_valid_var.numeric} 9 | \alias{assert_valid_var.POSIXct} 10 | \alias{assert_valid_var.default} 11 | \title{Check whether var is valid} 12 | \usage{ 13 | assert_valid_var(x, label, na_ok, empty_ok, ...) 14 | 15 | \method{assert_valid_var}{character}( 16 | x, 17 | label = deparse(substitute(x)), 18 | na_ok = FALSE, 19 | empty_ok = FALSE, 20 | min_chars = 1L, 21 | ... 22 | ) 23 | 24 | \method{assert_valid_var}{factor}( 25 | x, 26 | label = deparse(substitute(x)), 27 | na_ok = FALSE, 28 | empty_ok = FALSE, 29 | min_chars = 1L, 30 | ... 31 | ) 32 | 33 | \method{assert_valid_var}{logical}( 34 | x, 35 | label = deparse(substitute(x)), 36 | na_ok = TRUE, 37 | empty_ok = FALSE, 38 | ... 39 | ) 40 | 41 | \method{assert_valid_var}{numeric}( 42 | x, 43 | label = deparse(substitute(x)), 44 | na_ok = TRUE, 45 | empty_ok = FALSE, 46 | integerish = FALSE, 47 | ... 48 | ) 49 | 50 | \method{assert_valid_var}{POSIXct}( 51 | x, 52 | label = deparse(substitute(x)), 53 | na_ok = TRUE, 54 | empty_ok = FALSE, 55 | tzs = OlsonNames(), 56 | ... 57 | ) 58 | 59 | \method{assert_valid_var}{default}( 60 | x, 61 | label = deparse(substitute(x)), 62 | na_ok = FALSE, 63 | empty_ok = FALSE, 64 | ... 65 | ) 66 | } 67 | \arguments{ 68 | \item{x}{value of col_split variable} 69 | 70 | \item{label}{(\code{string}) hints.} 71 | 72 | \item{na_ok}{(\code{flag}) whether NA value is allowed} 73 | 74 | \item{empty_ok}{(\code{flag}) whether length 0 value is allowed.} 75 | 76 | \item{...}{Further arguments to methods.} 77 | 78 | \item{min_chars}{(\code{integer}) the minimum length of the characters.} 79 | 80 | \item{integerish}{(\code{flag}) whether the number should be treated as \code{integerish}.} 81 | 82 | \item{tzs}{(\code{character}) time zones.} 83 | } 84 | \value{ 85 | invisible \code{NULL} or an error message if the criteria are not fulfilled. 86 | } 87 | \description{ 88 | Check whether var is valid 89 | } 90 | \details{ 91 | This function checks the variable values are valid or not. 92 | } 93 | -------------------------------------------------------------------------------- /man/assert_valid_var_pair.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/assertions.R 3 | \name{assert_valid_var_pair} 4 | \alias{assert_valid_var_pair} 5 | \title{Check variables are of same levels} 6 | \usage{ 7 | assert_valid_var_pair( 8 | df1, 9 | df2, 10 | var, 11 | lab1 = deparse(substitute(df1)), 12 | lab2 = deparse(substitute(df2)) 13 | ) 14 | } 15 | \arguments{ 16 | \item{df1}{(\code{data.frame}) input.} 17 | 18 | \item{df2}{(\code{data.frame}) input.} 19 | 20 | \item{var}{(\code{string}) variable to check.} 21 | 22 | \item{lab1}{(\code{string}) label hint for \code{df1}.} 23 | 24 | \item{lab2}{(\code{string}) label hint for \code{df2}.} 25 | } 26 | \value{ 27 | invisible \code{NULL} or an error message if the criteria are not fulfilled. 28 | } 29 | \description{ 30 | Check variables are of same levels 31 | } 32 | -------------------------------------------------------------------------------- /man/assert_valid_variable.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/assertions.R 3 | \name{assert_valid_variable} 4 | \alias{assert_valid_variable} 5 | \title{Check variables in a data frame are valid character or factor.} 6 | \usage{ 7 | assert_valid_variable( 8 | df, 9 | vars, 10 | label = deparse(substitute(df)), 11 | types = NULL, 12 | ... 13 | ) 14 | } 15 | \arguments{ 16 | \item{df}{(\code{data.frame}) input dataset.} 17 | 18 | \item{vars}{(\code{character}) variables to check.} 19 | 20 | \item{label}{(\code{string}) labels of the data frame.} 21 | 22 | \item{types}{Named (\code{list}) of type of the input.} 23 | 24 | \item{...}{further arguments for \code{assert_valid_var}. Please note that different methods have different arguments 25 | so if provided make sure the variables to check is of the same class.} 26 | } 27 | \value{ 28 | invisible \code{TRUE} or an error message if the criteria are not fulfilled. 29 | } 30 | \description{ 31 | Check variables in a data frame are valid character or factor. 32 | } 33 | -------------------------------------------------------------------------------- /man/cfbt01_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cfbt01.R 3 | \name{cfbt01_lyt} 4 | \alias{cfbt01_lyt} 5 | \title{\code{cfbt01} Layout} 6 | \usage{ 7 | cfbt01_lyt( 8 | arm_var, 9 | lbl_overall, 10 | lbl_avisit, 11 | lbl_param, 12 | summaryvars, 13 | summaryvars_lbls, 14 | row_split_var, 15 | row_split_lbl, 16 | visitvar, 17 | precision, 18 | page_var, 19 | .stats, 20 | skip, 21 | ... 22 | ) 23 | } 24 | \arguments{ 25 | \item{arm_var}{(\code{string}) variable used for column splitting} 26 | 27 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 28 | 29 | \item{lbl_avisit}{(\code{string}) label of the \code{visitvar} variable.} 30 | 31 | \item{lbl_param}{(\code{string}) label of the \code{PARAM} variable.} 32 | 33 | \item{summaryvars}{(\code{character}) the variables to be analyzed. For this table, \code{AVAL} and \code{CHG} by default.} 34 | 35 | \item{summaryvars_lbls}{(\code{character}) the label of the variables to be analyzed.} 36 | 37 | \item{row_split_var}{(\code{character}) additional row split variables.} 38 | 39 | \item{row_split_lbl}{(\code{character}) label of further row splits.} 40 | 41 | \item{visitvar}{(\code{string}) typically one of \code{"AVISIT"} or user-defined visit incorporating \code{"ATPT"}.} 42 | 43 | \item{precision}{(named \code{list} of \code{integer}) where names are values found in the \code{PARAMCD} column and the values 44 | indicate the number of digits in statistics. If \code{default} is set, and parameter precision not specified, 45 | the value for \code{default} will be used. If \code{default} is not set, the default precision is 2.} 46 | 47 | \item{page_var}{(\code{string}) variable name prior to which the row split is by page.} 48 | 49 | \item{.stats}{(\code{character}) statistics names, see \code{tern::analyze_vars()}.} 50 | 51 | \item{skip}{Named (\code{list}) of visit values that need to be inhibited.} 52 | 53 | \item{...}{not used.} 54 | } 55 | \value{ 56 | a \code{PreDataTableLayouts} object. 57 | } 58 | \description{ 59 | \code{cfbt01} Layout 60 | } 61 | \keyword{internal} 62 | -------------------------------------------------------------------------------- /man/check_all_colnames.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/checks.R 3 | \name{check_all_colnames} 4 | \alias{check_all_colnames} 5 | \title{Check that all names are among column names} 6 | \usage{ 7 | check_all_colnames(df, x, null_ok = TRUE, qualifier = NULL) 8 | } 9 | \arguments{ 10 | \item{df}{(\code{data.frame})} 11 | 12 | \item{x}{(\code{character}) the names of the columns to be checked.} 13 | 14 | \item{null_ok}{(\code{flag}) can \code{x} be NULL.} 15 | 16 | \item{qualifier}{(\code{string}) to be returned if the check fails.} 17 | } 18 | \value{ 19 | invisible \code{NULL} or a string if the criteria are not fulfilled. 20 | } 21 | \description{ 22 | Check that all names are among column names 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/check_one_colnames.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/checks.R 3 | \name{check_one_colnames} 4 | \alias{check_one_colnames} 5 | \title{Check that at least one name is among column names} 6 | \usage{ 7 | check_one_colnames(df, x, null_ok = TRUE, qualifier = NULL) 8 | } 9 | \arguments{ 10 | \item{df}{(\code{data.frame})} 11 | 12 | \item{x}{(\code{character}) the names of the columns to be checked.} 13 | 14 | \item{null_ok}{(\code{flag}) can \code{x} be NULL.} 15 | 16 | \item{qualifier}{(\code{string}) to be returned if the check fails.} 17 | } 18 | \value{ 19 | invisible \code{NULL} or a string if the criteria are not fulfilled. 20 | } 21 | \description{ 22 | Check that at least one name is among column names 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/chevron-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/package.R 3 | \docType{package} 4 | \name{chevron-package} 5 | \alias{chevron} 6 | \alias{chevron-package} 7 | \title{\code{chevron} package} 8 | \description{ 9 | Provide standard tables, listings, and graphs (TLGs) libraries used in clinical trials. This package implements a structure to reformat the data with 'dunlin', create reporting tables using 'rtables' and 'tern' with standardized input arguments to enable quick generation of standard outputs. In addition, it also provides comprehensive data checks and script generation functionality. 10 | } 11 | \seealso{ 12 | Useful links: 13 | \itemize{ 14 | \item \url{https://insightsengineering.github.io/chevron/} 15 | \item \url{https://github.com/insightsengineering/chevron/} 16 | \item Report bugs at \url{https://github.com/insightsengineering/chevron/issues} 17 | } 18 | 19 | } 20 | \author{ 21 | \strong{Maintainer}: Joe Zhu \email{joe.zhu@roche.com} (\href{https://orcid.org/0000-0001-7566-2787}{ORCID}) 22 | 23 | Authors: 24 | \itemize{ 25 | \item Liming Li \email{liming.li@roche.com} (\href{https://orcid.org/0009-0008-6870-0878}{ORCID}) (Original creator of the package) 26 | \item Benoit Falquet \email{benoit.falquet@roche.com} (\href{https://orcid.org/0000-0002-4434-3799}{ORCID}) (Original creator of the package) 27 | \item Xiaoli Duan \email{xiaoli.duan@roche.com} 28 | } 29 | 30 | Other contributors: 31 | \itemize{ 32 | \item Adrian Waddell \email{waddell.adrian@gene.com} [contributor] 33 | \item Chenkai Lv \email{chenkai.lv@roche.com} [contributor] 34 | \item Pawel Rucki \email{pawel.rucki@roche.com} [contributor] 35 | \item Tim Barnett \email{timothy.barnett@roche.com} [contributor] 36 | \item Tian Fang \email{tian.fang@roche.com} [contributor] 37 | \item F. Hoffmann-La Roche AG [copyright holder, funder] 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /man/cml02a_gl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/cml02a_gl.R 3 | \docType{data} 4 | \name{cml02a_gl_main} 5 | \alias{cml02a_gl_main} 6 | \alias{cml02a_gl_pre} 7 | \alias{cml02a_gl} 8 | \title{\code{CML02A_GL} Listing 1 (Default) Concomitant Medication Class Level 2, Preferred Name, and Investigator-Specified 9 | Terms.} 10 | \format{ 11 | An object of class \code{chevron_l} of length 1. 12 | } 13 | \usage{ 14 | cml02a_gl_main( 15 | adam_db, 16 | dataset = "adcm", 17 | key_cols = c("ATC2", "CMDECOD"), 18 | disp_cols = c("ATC2", "CMDECOD", "CMTRT"), 19 | split_into_pages_by_var = NULL, 20 | unique_rows = TRUE, 21 | ... 22 | ) 23 | 24 | cml02a_gl_pre( 25 | adam_db, 26 | dataset = "adcm", 27 | disp_cols = c("ATC2", "CMDECOD", "CMTRT"), 28 | ... 29 | ) 30 | 31 | cml02a_gl 32 | } 33 | \arguments{ 34 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 35 | 36 | \item{dataset}{(\code{string}) the name of a table in the \code{adam_db} object.} 37 | 38 | \item{key_cols}{(\code{character}) names of columns that should be treated as key columns when rendering the listing. 39 | Key columns allow you to group repeat occurrences.} 40 | 41 | \item{disp_cols}{(\code{character}) names of non-key columns which should be displayed when the listing is rendered.} 42 | 43 | \item{split_into_pages_by_var}{(\code{character} or \code{NULL}) the name of the variable to split the listing by.} 44 | 45 | \item{unique_rows}{(\code{flag}) whether to keep only unique rows in listing.} 46 | 47 | \item{...}{not used.} 48 | } 49 | \value{ 50 | the main function returns an \code{rlistings} or a \code{list} object. 51 | 52 | the preprocessing function returns a \code{list} of \code{data.frame}. 53 | } 54 | \description{ 55 | \code{CML02A_GL} Listing 1 (Default) Concomitant Medication Class Level 2, Preferred Name, and Investigator-Specified 56 | Terms. 57 | } 58 | \section{Functions}{ 59 | \itemize{ 60 | \item \code{cml02a_gl_main()}: Main TLG function 61 | 62 | \item \code{cml02a_gl_pre()}: Preprocessing 63 | 64 | }} 65 | \examples{ 66 | run(cml02a_gl, syn_data) 67 | } 68 | \keyword{datasets} 69 | -------------------------------------------------------------------------------- /man/convert_to_month.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{convert_to_month} 4 | \alias{convert_to_month} 5 | \title{Helper function to convert to months if needed} 6 | \usage{ 7 | convert_to_month(x, unit) 8 | } 9 | \arguments{ 10 | \item{x}{(\code{numeric}) time.} 11 | 12 | \item{unit}{(\code{character}) or (\code{factor}) time unit.} 13 | } 14 | \value{ 15 | A \code{numeric} vector with the time in months. 16 | } 17 | \description{ 18 | Helper function to convert to months if needed 19 | } 20 | -------------------------------------------------------------------------------- /man/count_children.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{count_children} 4 | \alias{count_children} 5 | \title{Count Children} 6 | \usage{ 7 | count_children(x) 8 | } 9 | \description{ 10 | Count Children 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/count_or_summarize.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{count_or_summarize} 4 | \alias{count_or_summarize} 5 | \title{Count or summarize by groups} 6 | \usage{ 7 | count_or_summarize(lyt, var, level, detail_vars, indent_mod = 0L, ...) 8 | } 9 | \arguments{ 10 | \item{lyt}{(\code{PreDataTableLayouts}) \code{rtable} layout.} 11 | 12 | \item{var}{(\code{string}) of analysis variable.} 13 | 14 | \item{level}{(\code{string}) level to be displayed.} 15 | 16 | \item{detail_vars}{(\code{character}) of variables for detail information.} 17 | } 18 | \description{ 19 | Count or summarize by groups 20 | } 21 | \keyword{internal} 22 | -------------------------------------------------------------------------------- /man/count_patients_recursive.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{count_patients_recursive} 4 | \alias{count_patients_recursive} 5 | \title{Count patients recursively} 6 | \usage{ 7 | count_patients_recursive(lyt, anl_vars, anl_lbls, lbl_vars) 8 | } 9 | \arguments{ 10 | \item{lyt}{(\code{PreDataTableLayouts}) \code{rtable} layout.} 11 | 12 | \item{anl_vars}{Named (\code{list}) of analysis variables.} 13 | 14 | \item{anl_lbls}{(\code{character}) of labels.} 15 | 16 | \item{lbl_vars}{Named (\code{list}) of analysis labels.} 17 | } 18 | \description{ 19 | Count patients recursively 20 | } 21 | \keyword{internal} 22 | -------------------------------------------------------------------------------- /man/coxt01_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/coxt01.R 3 | \name{coxt01_lyt} 4 | \alias{coxt01_lyt} 5 | \title{\code{COXT01} Layout} 6 | \usage{ 7 | coxt01_lyt(variables, col_split, lbl_vars, control, multivar, ...) 8 | } 9 | \arguments{ 10 | \item{variables}{(\code{list}) list of variables in a Cox proportional hazards regression model.} 11 | 12 | \item{lbl_vars}{(\code{string}) text label for the a Cox regression model variables.} 13 | 14 | \item{multivar}{(\code{flag}) indicator of whether multivariate cox regression is conducted.} 15 | 16 | \item{...}{Further arguments passed to \code{tern::control_coxreg()}.} 17 | } 18 | \value{ 19 | a \code{PreDataTableLayouts} object. 20 | } 21 | \description{ 22 | \code{COXT01} Layout 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/create_id_listings.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{create_id_listings} 4 | \alias{create_id_listings} 5 | \title{Concatenate Site and Subject ID} 6 | \usage{ 7 | create_id_listings(site, subject, sep = "/") 8 | } 9 | \arguments{ 10 | \item{site}{(\code{string})} 11 | 12 | \item{subject}{(\code{string})} 13 | 14 | \item{sep}{(\code{string})} 15 | } 16 | \description{ 17 | Concatenate Site and Subject ID 18 | } 19 | \note{ 20 | the \code{{Patient_label}} whisker placeholder will be used in the label. 21 | } 22 | \examples{ 23 | create_id_listings("BRA-1", "xxx-1234") 24 | } 25 | -------------------------------------------------------------------------------- /man/ctcv4_dir.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{ctcv4_dir} 5 | \alias{ctcv4_dir} 6 | \title{CTC version 4 Grade Direction Data} 7 | \format{ 8 | An object of class \code{data.frame} with 35 rows and 3 columns. 9 | } 10 | \usage{ 11 | ctcv4_dir 12 | } 13 | \description{ 14 | CTC version 4 Grade Direction Data 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /man/ctcv5_dir.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{ctcv5_dir} 5 | \alias{ctcv5_dir} 6 | \title{CTC version 5 Grade Direction Data} 7 | \format{ 8 | An object of class \code{data.frame} with 35 rows and 3 columns. 9 | } 10 | \usage{ 11 | ctcv5_dir 12 | } 13 | \description{ 14 | CTC version 5 Grade Direction Data 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /man/dataset.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/chevron_tlg-S4methods.R 3 | \name{dataset} 4 | \alias{dataset} 5 | \alias{dataset,chevron_tlg-method} 6 | \alias{dataset<-} 7 | \alias{dataset<-,chevron_tlg-method} 8 | \title{Data Set} 9 | \usage{ 10 | dataset(x) 11 | 12 | \S4method{dataset}{chevron_tlg}(x) 13 | 14 | dataset(x) <- value 15 | 16 | \S4method{dataset}{chevron_tlg}(x) <- value 17 | } 18 | \arguments{ 19 | \item{x}{(\code{chevron_tlg}) input.} 20 | 21 | \item{value}{(\code{character} or \code{NULL}) defining the dataset slot.} 22 | } 23 | \value{ 24 | the \code{character} stored in the \code{dataset} slot of the \code{x} argument. 25 | } 26 | \description{ 27 | retrieve or set \code{dataset} slot. 28 | } 29 | -------------------------------------------------------------------------------- /man/deparse_print.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/chevron_tlg-S4methods.R 3 | \name{deparse_print} 4 | \alias{deparse_print} 5 | \title{Deparse print} 6 | \usage{ 7 | deparse_print(x, indent, max_line = getOption("chevron.arg_max_line", 5L)) 8 | } 9 | \description{ 10 | Deparse print 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/dmt01_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dmt01.R 3 | \name{dmt01_lyt} 4 | \alias{dmt01_lyt} 5 | \title{\code{dmt01} Layout} 6 | \usage{ 7 | dmt01_lyt( 8 | arm_var, 9 | lbl_overall, 10 | summaryvars, 11 | summaryvars_lbls, 12 | stats, 13 | precision 14 | ) 15 | } 16 | \arguments{ 17 | \item{arm_var}{(\code{string}) variable used for column splitting} 18 | 19 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 20 | 21 | \item{summaryvars_lbls}{(\code{character}) labels corresponding to the analyzed variables.} 22 | } 23 | \value{ 24 | a \code{PreDataTableLayouts} object. 25 | } 26 | \description{ 27 | \code{dmt01} Layout 28 | } 29 | \keyword{internal} 30 | -------------------------------------------------------------------------------- /man/do_call.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{do_call} 4 | \alias{do_call} 5 | \title{Execute a function call} 6 | \usage{ 7 | do_call(what, args) 8 | } 9 | \description{ 10 | Execute a function call 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/dose_change_rule.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/standard_rules.R 3 | \docType{data} 4 | \name{dose_change_rule} 5 | \alias{dose_change_rule} 6 | \title{Dose Change Rule} 7 | \format{ 8 | An object of class \code{rule} (inherits from \code{character}) of length 9. 9 | } 10 | \usage{ 11 | dose_change_rule 12 | } 13 | \description{ 14 | Dose Change Rule 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /man/dst01_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dst01.R 3 | \name{dst01_lyt} 4 | \alias{dst01_lyt} 5 | \title{\code{dst01} Layout} 6 | \usage{ 7 | dst01_lyt(arm_var, lbl_overall, study_status_var, detail_vars, trt_status_var) 8 | } 9 | \arguments{ 10 | \item{arm_var}{(\code{string}) variable. Usually one of \code{ARM}, \code{ACTARM}, \code{TRT01A}, or \code{TRT01A}.} 11 | 12 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 13 | 14 | \item{study_status_var}{(\code{string}) variable used to define patient status. Default is \code{EOSSTT}, however can also be a 15 | variable name with the pattern \code{EOPxxSTT} where \code{xx} must be substituted by 2 digits referring to the analysis 16 | period.} 17 | 18 | \item{detail_vars}{Named (\code{list}) of grouped display of \code{study_status_var}.} 19 | 20 | \item{trt_status_var}{(\code{string}) variable of treatment status.} 21 | } 22 | \value{ 23 | a \code{PreDataTableLayouts} object. 24 | } 25 | \description{ 26 | \code{dst01} Layout 27 | } 28 | \keyword{internal} 29 | -------------------------------------------------------------------------------- /man/dtht01_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dtht01.R 3 | \name{dtht01_lyt} 4 | \alias{dtht01_lyt} 5 | \title{\code{dtht01} Layout} 6 | \usage{ 7 | dtht01_lyt( 8 | arm_var, 9 | lbl_overall, 10 | death_flag, 11 | death_var, 12 | other_level, 13 | other_var, 14 | dose_death_var 15 | ) 16 | } 17 | \arguments{ 18 | \item{arm_var}{(\code{string}) variable used for column splitting} 19 | 20 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 21 | 22 | \item{death_flag}{(\code{string}) variable name of death flag.} 23 | 24 | \item{death_var}{(\code{string}) variable name of death category.} 25 | 26 | \item{other_level}{(\code{string}) \code{"Other"} level in death category.} 27 | 28 | \item{other_var}{(\code{string}) variable name of death cause under \code{"Other"}.} 29 | 30 | \item{dose_death_var}{(\code{string}) variable name of the days from last dose.} 31 | } 32 | \value{ 33 | a \code{PreDataTableLayouts} object. 34 | } 35 | \description{ 36 | \code{dtht01} Layout 37 | } 38 | \keyword{internal} 39 | -------------------------------------------------------------------------------- /man/dummy_template.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dummy_template.R 3 | \docType{data} 4 | \name{dummy_template} 5 | \alias{dummy_template} 6 | \title{Dummy template.} 7 | \format{ 8 | An object of class \code{chevron_simple} of length 1. 9 | } 10 | \usage{ 11 | dummy_template 12 | } 13 | \description{ 14 | This template creates a dummy output. 15 | } 16 | \examples{ 17 | run(dummy_template, syn_data) 18 | } 19 | \keyword{datasets} 20 | -------------------------------------------------------------------------------- /man/egt02_1.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/egt02.R 3 | \docType{data} 4 | \name{egt02_1_main} 5 | \alias{egt02_1_main} 6 | \alias{egt02_pre} 7 | \alias{egt02_post} 8 | \alias{egt02_1} 9 | \title{\code{EGT02} ECG Abnormalities Table.} 10 | \format{ 11 | An object of class \code{chevron_t} of length 1. 12 | } 13 | \usage{ 14 | egt02_1_main( 15 | adam_db, 16 | arm_var = "ACTARM", 17 | lbl_overall = NULL, 18 | exclude_base_abn = FALSE, 19 | ... 20 | ) 21 | 22 | egt02_pre(adam_db, ...) 23 | 24 | egt02_post(tlg, ...) 25 | 26 | egt02_1 27 | } 28 | \arguments{ 29 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 30 | 31 | \item{arm_var}{(\code{string}) variable used for column splitting} 32 | 33 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 34 | 35 | \item{exclude_base_abn}{(\code{flag}) whether baseline abnormality should be excluded.} 36 | 37 | \item{...}{not used.} 38 | 39 | \item{tlg}{(\code{TableTree}, \code{Listing} or \code{ggplot}) object typically produced by a \code{main} function.} 40 | } 41 | \value{ 42 | the main function returns an \code{rtables} object 43 | 44 | the preprocessing function returns a \code{list} of \code{data.frame}. 45 | 46 | the postprocessing function returns an \code{rtables} object or an \code{ElementaryTable} (null report). 47 | } 48 | \description{ 49 | ECG Parameters outside Normal Limits Regardless of Abnormality at Baseline Table. 50 | } 51 | \details{ 52 | \itemize{ 53 | \item Only count LOW or HIGH values. 54 | \item Results of "LOW LOW" are treated as the same as "LOW", and "HIGH HIGH" the same as "HIGH". 55 | \item Does not include a total column by default. 56 | \item Does not remove zero-count rows unless overridden with \code{prune_0 = TRUE}. 57 | } 58 | } 59 | \section{Functions}{ 60 | \itemize{ 61 | \item \code{egt02_1_main()}: Main TLG function 62 | 63 | \item \code{egt02_pre()}: Preprocessing 64 | 65 | \item \code{egt02_post()}: Postprocessing 66 | 67 | }} 68 | \note{ 69 | \itemize{ 70 | \item \code{adam_db} object must contain an \code{adeg} table with the \code{"PARAM"}, \code{"ANRIND"} and \code{"BNRIND"} columns. 71 | } 72 | } 73 | \examples{ 74 | run(egt02_1, syn_data) 75 | } 76 | \keyword{datasets} 77 | -------------------------------------------------------------------------------- /man/egt02_2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/egt02.R 3 | \docType{data} 4 | \name{egt02_2_main} 5 | \alias{egt02_2_main} 6 | \alias{egt02_2} 7 | \title{\code{EGT02_2} ECG Abnormalities Table.} 8 | \format{ 9 | An object of class \code{chevron_t} of length 1. 10 | } 11 | \usage{ 12 | egt02_2_main( 13 | adam_db, 14 | arm_var = "ACTARM", 15 | lbl_overall = NULL, 16 | exclude_base_abn = TRUE, 17 | ... 18 | ) 19 | 20 | egt02_2 21 | } 22 | \arguments{ 23 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 24 | 25 | \item{arm_var}{(\code{string}) variable used for column splitting} 26 | 27 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 28 | 29 | \item{exclude_base_abn}{(\code{flag}) whether baseline abnormality should be excluded.} 30 | 31 | \item{...}{not used.} 32 | } 33 | \value{ 34 | the main function returns an \code{rtables} object 35 | 36 | the preprocessing function returns a \code{list} of \code{data.frame}. 37 | 38 | the postprocessing function returns an \code{rtables} object or an \code{ElementaryTable} (null report). 39 | } 40 | \description{ 41 | ECG Parameters outside Normal Limits Among Patients without Abnormality at Baseline Table. 42 | } 43 | \details{ 44 | \itemize{ 45 | \item Only count LOW or HIGH values. 46 | \item Results of "LOW LOW" are treated as the same as "LOW", and "HIGH HIGH" the same as "HIGH". 47 | \item Does not include a total column by default. 48 | \item Does not remove zero-count rows unless overridden with \code{prune_0 = TRUE}. 49 | } 50 | } 51 | \section{Functions}{ 52 | \itemize{ 53 | \item \code{egt02_2_main()}: Main TLG function 54 | 55 | }} 56 | \note{ 57 | \itemize{ 58 | \item \code{adam_db} object must contain an \code{adeg} table with the \code{"PARAM"}, \code{"ANRIND"} and \code{"BNRIND"} columns. 59 | } 60 | } 61 | \examples{ 62 | run(egt02_2, syn_data) 63 | } 64 | \keyword{datasets} 65 | -------------------------------------------------------------------------------- /man/egt02_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/egt02.R 3 | \name{egt02_lyt} 4 | \alias{egt02_lyt} 5 | \title{\code{egt02} Layout} 6 | \usage{ 7 | egt02_lyt( 8 | arm_var = "ACTARM", 9 | lbl_overall, 10 | lbl_vs_assessment = "Assessment", 11 | lbl_vs_abnormality = "Abnormality", 12 | exclude_base_abn 13 | ) 14 | } 15 | \arguments{ 16 | \item{arm_var}{(\code{string}) variable used for column splitting} 17 | 18 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 19 | 20 | \item{lbl_vs_assessment}{(\code{string}) the label of the assessment variable.} 21 | 22 | \item{lbl_vs_abnormality}{(\code{string}) the label of the abnormality variable.} 23 | 24 | \item{exclude_base_abn}{(\code{flag}) whether to exclude subjects with baseline abnormality from numerator and 25 | denominator.} 26 | } 27 | \value{ 28 | a \code{PreDataTableLayouts} object. 29 | } 30 | \description{ 31 | \code{egt02} Layout 32 | } 33 | \keyword{internal} 34 | -------------------------------------------------------------------------------- /man/egt03_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/egt03.R 3 | \name{egt03_lyt} 4 | \alias{egt03_lyt} 5 | \title{\code{egt03} Layout} 6 | \usage{ 7 | egt03_lyt( 8 | arm_var, 9 | splitvar, 10 | summaryvar, 11 | lbl_armvar, 12 | lbl_summaryvars, 13 | lbl_param, 14 | page_var 15 | ) 16 | } 17 | \arguments{ 18 | \item{arm_var}{(\code{string}) variable used for column splitting} 19 | 20 | \item{splitvar}{(\code{character}) variables to be analyzed, typically \code{"ANRIND"}. Labels of the corresponding columns are 21 | used as subtitles.} 22 | 23 | \item{summaryvar}{(\code{character}) variables to be analyzed, typically \code{"BNRIND"}. Labels of the corresponding columns 24 | are used as subtitles.} 25 | 26 | \item{lbl_armvar}{(\code{string}) label of the \code{arm_var} variable.} 27 | 28 | \item{lbl_summaryvars}{(\code{string}) label of the \code{summaryvar} variable.} 29 | 30 | \item{page_var}{(\code{string}) variable name prior to which the row split is by page.} 31 | } 32 | \value{ 33 | a \code{PreDataTableLayouts} object. 34 | } 35 | \description{ 36 | \code{egt03} Layout 37 | } 38 | \keyword{internal} 39 | -------------------------------------------------------------------------------- /man/egt05_qtcat_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/egt05_qtcat.R 3 | \name{egt05_qtcat_lyt} 4 | \alias{egt05_qtcat_lyt} 5 | \title{\code{EGT05_QTCAT} Layout} 6 | \usage{ 7 | egt05_qtcat_lyt( 8 | arm_var, 9 | lbl_overall, 10 | lbl_avisit, 11 | lbl_param, 12 | lbl_cat, 13 | summaryvars, 14 | summaryvars_lbls, 15 | row_split_var, 16 | row_split_lbl, 17 | visitvar, 18 | page_var 19 | ) 20 | } 21 | \arguments{ 22 | \item{arm_var}{(\code{string}) variable used for column splitting} 23 | 24 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 25 | 26 | \item{lbl_avisit}{(\code{string}) label of the \code{visitvar} variable.} 27 | 28 | \item{lbl_param}{(\code{string}) label of the \code{PARAM} variable.} 29 | 30 | \item{lbl_cat}{(\code{string}) label of the Category of \code{summaryvars} variable. Default as \code{Category}.} 31 | 32 | \item{summaryvars}{(\code{character}) the variables to be analyzed. \code{AVALCAT1} and \code{CHGCAT1} by default.} 33 | 34 | \item{summaryvars_lbls}{(\code{character}) the label of the variables to be analyzed.} 35 | 36 | \item{row_split_var}{(\code{character}) additional row split variables.} 37 | 38 | \item{visitvar}{(\code{string}) typically \code{"AVISIT"} or user-defined visit incorporating \code{"ATPT"}.} 39 | 40 | \item{page_var}{(\code{string}) variable name prior to which the row split is by page.} 41 | } 42 | \value{ 43 | a \code{PreDataTableLayouts} object. 44 | } 45 | \description{ 46 | \code{EGT05_QTCAT} Layout 47 | } 48 | \keyword{internal} 49 | -------------------------------------------------------------------------------- /man/empty_rule.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/standard_rules.R 3 | \docType{data} 4 | \name{empty_rule} 5 | \alias{empty_rule} 6 | \title{Empty rule} 7 | \format{ 8 | An object of class \code{rule} (inherits from \code{character}) of length 0. 9 | } 10 | \usage{ 11 | empty_rule 12 | } 13 | \description{ 14 | Empty rule 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /man/execute_with_args.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{execute_with_args} 4 | \alias{execute_with_args} 5 | \title{Execute function with given arguments} 6 | \usage{ 7 | execute_with_args(fun, ...) 8 | } 9 | \description{ 10 | Execute function with given arguments 11 | } 12 | \details{ 13 | If the function has \code{...}, this function will not pass other arguments to \code{...}. 14 | Only named arguments are passed. 15 | } 16 | \keyword{internal} 17 | -------------------------------------------------------------------------------- /man/expand_list.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{expand_list} 4 | \alias{expand_list} 5 | \title{Expand list to each split} 6 | \usage{ 7 | expand_list(lst, split) 8 | } 9 | \description{ 10 | Expand list to each split 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/ext01_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ext01.R 3 | \name{ext01_lyt} 4 | \alias{ext01_lyt} 5 | \title{\code{ext01} Layout} 6 | \usage{ 7 | ext01_lyt( 8 | arm_var, 9 | lbl_overall, 10 | summaryvars, 11 | summaryvars_lbls, 12 | row_split_var, 13 | row_split_lbl, 14 | page_var, 15 | map, 16 | stats = list(default = c("n", "mean_sd", "median", "range", "count_fraction")), 17 | precision = list() 18 | ) 19 | } 20 | \arguments{ 21 | \item{arm_var}{(\code{string}) variable used for column splitting} 22 | 23 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 24 | 25 | \item{summaryvars}{(\code{character}) the name of the variable to be analyzed. By default \code{"AVAL"}.} 26 | 27 | \item{summaryvars_lbls}{(\code{character}) the label associated with the analyzed variable.} 28 | 29 | \item{row_split_var}{(\code{character}) additional row split variables.} 30 | 31 | \item{page_var}{(\code{string}) variable name prior to which the row split is by page.} 32 | } 33 | \value{ 34 | a \code{PreDataTableLayouts} object. 35 | } 36 | \description{ 37 | \code{ext01} Layout 38 | } 39 | \keyword{internal} 40 | -------------------------------------------------------------------------------- /man/format_date.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{format_date} 4 | \alias{format_date} 5 | \title{Formatting of date} 6 | \usage{ 7 | format_date(date_format = "\%d\%b\%Y") 8 | } 9 | \arguments{ 10 | \item{date_format}{(\code{string}) the output format.} 11 | } 12 | \value{ 13 | a \code{function} converting a date into \code{string}. 14 | } 15 | \description{ 16 | Formatting of date 17 | } 18 | \note{ 19 | The date is extracted at the location of the measure, not at the location of the system. 20 | } 21 | \examples{ 22 | format_date("\%d\%b\%Y")(as.Date("2021-01-01")) 23 | if ("NZ" \%in\% OlsonNames()) { 24 | format_date("\%d\%b\%Y")(as.POSIXct("2021-01-01 00:00:01", tz = "NZ")) 25 | } 26 | if ("US/Pacific" \%in\% OlsonNames()) { 27 | format_date("\%d\%b\%Y")(as.POSIXct("2021-01-01 00:00:01", tz = "US/Pacific")) 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /man/fuse_sequentially.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{fuse_sequentially} 4 | \alias{fuse_sequentially} 5 | \title{Fuse list elements} 6 | \usage{ 7 | fuse_sequentially(x, y) 8 | } 9 | \arguments{ 10 | \item{x}{(\code{list}) to fuse.} 11 | 12 | \item{y}{(\code{list}) to fuse. Elements with names already existing in \code{x} are discarded.} 13 | } 14 | \description{ 15 | Fuse list elements 16 | } 17 | \keyword{internal} 18 | -------------------------------------------------------------------------------- /man/get_grade_rule.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/standard_rules.R 3 | \name{get_grade_rule} 4 | \alias{get_grade_rule} 5 | \title{Get grade rule} 6 | \usage{ 7 | get_grade_rule(direction = "high", missing = "incl") 8 | } 9 | \arguments{ 10 | \item{direction}{(\code{string}) of abnormality direction.} 11 | 12 | \item{missing}{(\code{string}) method to deal with missing} 13 | } 14 | \value{ 15 | a \code{rule} object. 16 | } 17 | \description{ 18 | Get grade rule 19 | } 20 | -------------------------------------------------------------------------------- /man/get_page_by.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{get_page_by} 4 | \alias{get_page_by} 5 | \title{Get page by value} 6 | \usage{ 7 | get_page_by(var, vars) 8 | } 9 | \description{ 10 | Get page by value 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/get_section_div.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{get_section_div} 4 | \alias{get_section_div} 5 | \title{Get Section dividers} 6 | \usage{ 7 | get_section_div() 8 | } 9 | \value{ 10 | (\code{character}) value with section dividers at corresponding section. 11 | } 12 | \description{ 13 | Get Section dividers 14 | } 15 | -------------------------------------------------------------------------------- /man/get_subset.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/chevron_tlg-S4methods.R 3 | \name{get_subset} 4 | \alias{get_subset} 5 | \title{Subset Arguments and Merge} 6 | \usage{ 7 | get_subset(x, y) 8 | } 9 | \description{ 10 | Subset Arguments and Merge 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/get_x_hjust.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{get_x_hjust} 4 | \alias{get_x_hjust} 5 | \title{Get a harmonious value of horizontal justification for x axis} 6 | \usage{ 7 | get_x_hjust(x) 8 | } 9 | \arguments{ 10 | \item{x}{(\code{numeric}) angle between -90 and 90 degree.} 11 | } 12 | \description{ 13 | Get a harmonious value of horizontal justification for x axis 14 | } 15 | \keyword{internal} 16 | -------------------------------------------------------------------------------- /man/get_x_vjust.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{get_x_vjust} 4 | \alias{get_x_vjust} 5 | \title{Get a harmonious value of vertical justification for x axis} 6 | \usage{ 7 | get_x_vjust(x) 8 | } 9 | \arguments{ 10 | \item{x}{(\code{numeric}) angle between -90 and 90 degree.} 11 | } 12 | \description{ 13 | Get a harmonious value of vertical justification for x axis 14 | } 15 | \keyword{internal} 16 | -------------------------------------------------------------------------------- /man/gg_list.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{gg_list} 4 | \alias{gg_list} 5 | \title{List of \code{gg} object} 6 | \usage{ 7 | gg_list(...) 8 | } 9 | \arguments{ 10 | \item{...}{(\code{ggplot}) objects.} 11 | } 12 | \value{ 13 | a \code{gg_list} object. 14 | } 15 | \description{ 16 | \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} 17 | } 18 | -------------------------------------------------------------------------------- /man/gg_theme_chevron.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{gg_theme_chevron} 4 | \alias{gg_theme_chevron} 5 | \title{Theme for Chevron Plot} 6 | \usage{ 7 | gg_theme_chevron( 8 | grid_y = TRUE, 9 | grid_x = FALSE, 10 | legend_position = "top", 11 | text_axis_x_rot = 45 12 | ) 13 | } 14 | \arguments{ 15 | \item{grid_y}{(\code{flag}) should horizontal grid be displayed.} 16 | 17 | \item{grid_x}{(\code{flag}) should vertical grid be displayed.} 18 | 19 | \item{legend_position}{(\code{string}) the position of the legend.} 20 | 21 | \item{text_axis_x_rot}{(\code{numeric}) the x axis text rotation angle.} 22 | } 23 | \value{ 24 | a \code{theme} object. 25 | } 26 | \description{ 27 | Theme for Chevron Plot 28 | } 29 | -------------------------------------------------------------------------------- /man/grob_list.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{grob_list} 4 | \alias{grob_list} 5 | \title{List of \code{grob} object} 6 | \usage{ 7 | grob_list(...) 8 | } 9 | \arguments{ 10 | \item{...}{(\code{grob}) objects.} 11 | } 12 | \value{ 13 | a \code{grob_list} object. 14 | } 15 | \description{ 16 | \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} 17 | } 18 | -------------------------------------------------------------------------------- /man/h_format_dec.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{h_format_dec} 4 | \alias{h_format_dec} 5 | \title{Decimal formatting} 6 | \usage{ 7 | h_format_dec(digits, format, ne = NULL) 8 | } 9 | \arguments{ 10 | \item{digits}{(\code{integer}) number of digits.} 11 | 12 | \item{format}{(\code{string}) describing how the numbers should be formatted following the \code{sprintf} syntax.} 13 | 14 | \item{ne}{(\code{string}) that should replace actual value. If \code{NULL}, no replacement is performed.} 15 | } 16 | \value{ 17 | \code{function} formatting numbers with the defined format. 18 | } 19 | \description{ 20 | Decimal formatting 21 | } 22 | \examples{ 23 | fun <- h_format_dec(c(1, 1), "\%s - \%s") 24 | fun(c(123, 567.89)) 25 | } 26 | -------------------------------------------------------------------------------- /man/h_unwrap_layout.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/unwrap.R 3 | \name{h_unwrap_layout} 4 | \alias{h_unwrap_layout} 5 | \title{Helper Function Extracting Layout Functions} 6 | \usage{ 7 | h_unwrap_layout(x, pattern) 8 | } 9 | \description{ 10 | Helper Function Extracting Layout Functions 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/ifneeded_split_col.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{ifneeded_split_col} 4 | \alias{ifneeded_split_col} 5 | \title{Helper function to add a column split if specified} 6 | \usage{ 7 | ifneeded_split_col(lyt, var, ...) 8 | } 9 | \arguments{ 10 | \item{lyt}{(\code{rtables}) object.} 11 | 12 | \item{var}{(\code{string}) the name of the variable initiating a new column split.} 13 | 14 | \item{...}{Additional arguments for \code{split_cols_by}.} 15 | } 16 | \value{ 17 | \code{rtables} object. 18 | } 19 | \description{ 20 | Helper function to add a column split if specified 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/ifneeded_split_row.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{ifneeded_split_row} 4 | \alias{ifneeded_split_row} 5 | \title{Helper function to add a row split if specified} 6 | \usage{ 7 | ifneeded_split_row(lyt, var, lbl_var) 8 | } 9 | \arguments{ 10 | \item{lyt}{(\code{PreDataTableLayouts}) object.} 11 | 12 | \item{var}{(\code{string}) the name of the variable initiating a new row split.} 13 | 14 | \item{lbl_var}{(\code{string})the label of the variable \code{var}.} 15 | } 16 | \value{ 17 | \code{PreDataTableLayouts} object. 18 | } 19 | \description{ 20 | Helper function to add a row split if specified 21 | } 22 | \keyword{internal} 23 | -------------------------------------------------------------------------------- /man/lbt04_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lbt04.R 3 | \name{lbt04_lyt} 4 | \alias{lbt04_lyt} 5 | \title{\code{lbt04} Layout} 6 | \usage{ 7 | lbt04_lyt( 8 | arm_var, 9 | lbl_overall, 10 | lbl_param, 11 | lbl_abn_var, 12 | var_parcat, 13 | var_param, 14 | row_split_var, 15 | row_split_lbl, 16 | analysis_abn_var, 17 | variables, 18 | page_var 19 | ) 20 | } 21 | \arguments{ 22 | \item{arm_var}{(\code{string}) variable used for column splitting} 23 | 24 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 25 | 26 | \item{lbl_param}{(\code{string}) label of the \code{PARAM} variable.} 27 | 28 | \item{lbl_abn_var}{(\code{string}) label of the \code{analysis_abn_var} variable.} 29 | 30 | \item{row_split_var}{(\code{character}) additional row split variables.} 31 | 32 | \item{variables}{(\code{list}) see \link[tern:abnormal]{tern::count_abnormal}} 33 | 34 | \item{page_var}{(\code{string}) variable name prior to which the row split is by page.} 35 | } 36 | \description{ 37 | \code{lbt04} Layout 38 | } 39 | \keyword{internal} 40 | -------------------------------------------------------------------------------- /man/lbt05_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lbt05.R 3 | \name{lbt05_lyt} 4 | \alias{lbt05_lyt} 5 | \title{\code{lbt05} Layout} 6 | \usage{ 7 | lbt05_lyt(arm_var, lbl_overall, lbl_param, lbl_anrind, map) 8 | } 9 | \arguments{ 10 | \item{arm_var}{(\code{string}) variable used for column splitting} 11 | 12 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 13 | 14 | \item{lbl_param}{(\code{string}) label of the \code{PARAM} variable.} 15 | 16 | \item{lbl_anrind}{(\code{string}) label of the \code{ANRIND} variable.} 17 | 18 | \item{map}{(\code{data.frame}) mapping of \code{PARAM}s to directions of abnormality.} 19 | } 20 | \description{ 21 | \code{lbt05} Layout 22 | } 23 | \keyword{internal} 24 | -------------------------------------------------------------------------------- /man/lbt06_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lbt06.R 3 | \name{lbt06_lyt} 4 | \alias{lbt06_lyt} 5 | \title{\code{lbt06} Layout} 6 | \usage{ 7 | lbt06_lyt( 8 | arm_var, 9 | lbl_overall, 10 | lbl_param, 11 | lbl_visit, 12 | lbl_anrind, 13 | lbl_bnrind, 14 | visitvar, 15 | anrind_var, 16 | bnrind_var, 17 | page_var 18 | ) 19 | } 20 | \arguments{ 21 | \item{arm_var}{(\code{string}) variable used for column splitting} 22 | 23 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 24 | 25 | \item{lbl_param}{(\code{string}) text label of the \code{PARAM} variable.} 26 | 27 | \item{lbl_visit}{(\code{string}) text label of the \code{AVISIT} variable.} 28 | 29 | \item{lbl_anrind}{(\code{string}) text label of the \code{ANRIND} variable.} 30 | 31 | \item{lbl_bnrind}{(\code{string}) text label of the \code{BNRIND} variable.} 32 | 33 | \item{visitvar}{(\code{string}) typically \code{"AVISIT"} or user-defined visit incorporating \code{"ATPT"}.} 34 | 35 | \item{anrind_var}{(\code{string}) the variable for analysis reference range indicator.} 36 | 37 | \item{bnrind_var}{(\code{string}) the variable for baseline reference range indicator.} 38 | 39 | \item{page_var}{(\code{string}) variable name prior to which the row split is by page.} 40 | } 41 | \description{ 42 | \code{lbt06} Layout 43 | } 44 | \keyword{internal} 45 | -------------------------------------------------------------------------------- /man/lbt07_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lbt07.R 3 | \name{lbt07_lyt} 4 | \alias{lbt07_lyt} 5 | \title{\code{lbt07} Layout} 6 | \usage{ 7 | lbt07_lyt( 8 | arm_var, 9 | lbl_overall, 10 | lbl_param_var, 11 | lbl_grad_dir_var, 12 | param_var, 13 | grad_dir_var, 14 | grad_anl_var, 15 | map 16 | ) 17 | } 18 | \arguments{ 19 | \item{arm_var}{(\code{string}) variable used for column splitting} 20 | 21 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 22 | 23 | \item{lbl_param_var}{(\code{string}) label of the \code{param_var} variable.} 24 | 25 | \item{lbl_grad_dir_var}{(\code{string}) label for the \code{grad_dir_var} variable.} 26 | 27 | \item{param_var}{(\code{string}) the name of the column storing the parameters name.} 28 | 29 | \item{grad_dir_var}{(\code{string}) the name of the column storing the grade direction variable which is required in 30 | order to obtain the correct denominators when building the layout as it is used to define row splitting.} 31 | 32 | \item{grad_anl_var}{(\code{string}) the name of the column storing toxicity grade variable where all negative values from 33 | \code{ATOXGR} are replaced by their absolute values.} 34 | 35 | \item{map}{(\code{data.frame}) mapping of \code{PARAM}s to directions of abnormality.} 36 | } 37 | \description{ 38 | \code{lbt07} Layout 39 | } 40 | \keyword{internal} 41 | -------------------------------------------------------------------------------- /man/lbt14_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lbt14.R 3 | \name{lbt14_lyt} 4 | \alias{lbt14_lyt} 5 | \title{\code{lbt14} Layout} 6 | \usage{ 7 | lbt14_lyt(arm_var, lbl_overall, lbl_param, lbl_btoxgr, page_var) 8 | } 9 | \arguments{ 10 | \item{arm_var}{(\code{string}) variable used for column splitting} 11 | 12 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 13 | 14 | \item{page_var}{(\code{string}) variable name prior to which the row split is by page.} 15 | } 16 | \description{ 17 | \code{lbt14} Layout 18 | } 19 | \keyword{internal} 20 | -------------------------------------------------------------------------------- /man/lbt15.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/lbt15.R 3 | \docType{data} 4 | \name{lbt15_pre} 5 | \alias{lbt15_pre} 6 | \alias{lbt15} 7 | \title{\code{LBT15} Laboratory Test Shifts to \code{NCI-CTCAE} Grade 3-4 Post-Baseline Table.} 8 | \format{ 9 | An object of class \code{chevron_t} of length 1. 10 | } 11 | \source{ 12 | \code{lbt04.R} 13 | } 14 | \usage{ 15 | lbt15_pre(adam_db, ...) 16 | 17 | lbt15 18 | } 19 | \arguments{ 20 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 21 | 22 | \item{...}{not used.} 23 | } 24 | \value{ 25 | the preprocessing function returns a \code{list} of \code{data.frame}. 26 | } 27 | \description{ 28 | \code{LBT15} Laboratory Test Shifts to \code{NCI-CTCAE} Grade 3-4 Post-Baseline Table. 29 | } 30 | \section{Functions}{ 31 | \itemize{ 32 | \item \code{lbt15_pre()}: Preprocessing 33 | 34 | }} 35 | \examples{ 36 | run(lbt15, syn_data) 37 | } 38 | \keyword{datasets} 39 | -------------------------------------------------------------------------------- /man/listing_format_chevron.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{listing_format_chevron} 4 | \alias{listing_format_chevron} 5 | \title{Format for Chevron Listings} 6 | \usage{ 7 | listing_format_chevron() 8 | } 9 | \value{ 10 | a \code{list} of \code{fmt_config}. 11 | } 12 | \description{ 13 | Format for Chevron Listings 14 | } 15 | -------------------------------------------------------------------------------- /man/lvls.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{lvls} 4 | \alias{lvls} 5 | \title{Obtain levels from vector} 6 | \usage{ 7 | lvls(x) 8 | } 9 | \arguments{ 10 | \item{x}{(\code{character}) or (\code{factor}) object to obtain levels.} 11 | } 12 | \value{ 13 | \code{character} with unique values. 14 | } 15 | \description{ 16 | Obtain levels from vector 17 | } 18 | \details{ 19 | For factors, the levels will be returned. For characters, the sorted unique values will be returned. 20 | } 21 | -------------------------------------------------------------------------------- /man/main.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/chevron_tlg-S4methods.R 3 | \name{main} 4 | \alias{main} 5 | \alias{main,chevron_tlg-method} 6 | \alias{main<-} 7 | \alias{main<-,chevron_tlg-method} 8 | \title{Main} 9 | \usage{ 10 | main(x) 11 | 12 | \S4method{main}{chevron_tlg}(x) 13 | 14 | main(x) <- value 15 | 16 | \S4method{main}{chevron_tlg}(x) <- value 17 | } 18 | \arguments{ 19 | \item{x}{(\code{chevron_tlg}) input.} 20 | 21 | \item{value}{(\code{function}) returning a \code{tlg}. Typically one of the \verb{_main} function of \code{chevron}.} 22 | } 23 | \value{ 24 | the \code{function} stored in the \code{main} slot of the \code{x} argument. 25 | } 26 | \description{ 27 | retrieve or set \code{main} function. 28 | } 29 | -------------------------------------------------------------------------------- /man/missing_rule.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/standard_rules.R 3 | \docType{data} 4 | \name{missing_rule} 5 | \alias{missing_rule} 6 | \title{Missing rule} 7 | \format{ 8 | An object of class \code{rule} (inherits from \code{character}) of length 2. 9 | } 10 | \usage{ 11 | missing_rule 12 | } 13 | \description{ 14 | Missing rule 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /man/mla_dir.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{mla_dir} 5 | \alias{mla_dir} 6 | \title{MLA Grade Direction Data} 7 | \format{ 8 | An object of class \code{data.frame} with 76 rows and 2 columns. 9 | } 10 | \usage{ 11 | mla_dir 12 | } 13 | \description{ 14 | MLA Grade Direction Data 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /man/modify_character.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{modify_character} 4 | \alias{modify_character} 5 | \title{Modify character} 6 | \usage{ 7 | modify_character(x, y) 8 | } 9 | \description{ 10 | Modify character 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/nocoding.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/standard_rules.R 3 | \docType{data} 4 | \name{nocoding} 5 | \alias{nocoding} 6 | \title{No Coding Available rule} 7 | \format{ 8 | An object of class \code{rule} (inherits from \code{character}) of length 2. 9 | } 10 | \usage{ 11 | nocoding 12 | } 13 | \description{ 14 | No Coding Available rule 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /man/obtain_value.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{obtain_value} 4 | \alias{obtain_value} 5 | \title{Obtain value from a vector} 6 | \usage{ 7 | obtain_value(obj, index) 8 | } 9 | \description{ 10 | Obtain value from a vector 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/occurrence_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{occurrence_lyt} 4 | \alias{occurrence_lyt} 5 | \title{Occurrence Layout} 6 | \usage{ 7 | occurrence_lyt( 8 | arm_var, 9 | lbl_overall, 10 | row_split_var, 11 | lbl_row_split, 12 | medname_var, 13 | lbl_medname_var, 14 | summary_labels, 15 | count_by 16 | ) 17 | } 18 | \arguments{ 19 | \item{arm_var}{(\code{string}) variable used for column splitting} 20 | 21 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 22 | 23 | \item{row_split_var}{(\code{character}) additional row split variables.} 24 | 25 | \item{medname_var}{(\code{string}) variable name of medical treatment name.} 26 | 27 | \item{lbl_medname_var}{(\code{string}) label for the variable defining the medication name.} 28 | 29 | \item{summary_labels}{(\code{list}) of summarize labels. See details.} 30 | } 31 | \description{ 32 | Occurrence Layout 33 | } 34 | \keyword{internal} 35 | -------------------------------------------------------------------------------- /man/outcome_rule.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/standard_rules.R 3 | \docType{data} 4 | \name{outcome_rule} 5 | \alias{outcome_rule} 6 | \title{Outcome Rule} 7 | \format{ 8 | An object of class \code{rule} (inherits from \code{character}) of length 6. 9 | } 10 | \usage{ 11 | outcome_rule 12 | } 13 | \description{ 14 | Outcome Rule 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /man/pdt01_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pdt01.R 3 | \name{pdt01_lyt} 4 | \alias{pdt01_lyt} 5 | \title{\code{pdt01} Layout} 6 | \usage{ 7 | pdt01_lyt( 8 | arm_var, 9 | lbl_overall, 10 | dvcode_var, 11 | lbl_dvcode_var, 12 | dvterm_var, 13 | lbl_dvterm_var 14 | ) 15 | } 16 | \arguments{ 17 | \item{arm_var}{(\code{string}) variable used for column splitting} 18 | 19 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 20 | 21 | \item{dvcode_var}{(\code{string}) the variable defining the protocol deviation coded term. By default \code{DVDECOD}.} 22 | 23 | \item{lbl_dvcode_var}{(\code{string}) label for the variable defining the protocol deviation coded term.} 24 | 25 | \item{dvterm_var}{(\code{string}) the variable defining the protocol deviation term. By default \code{DVTERM}.} 26 | 27 | \item{lbl_dvterm_var}{(\code{string}) label for the variable defining the protocol deviation term.} 28 | } 29 | \description{ 30 | \code{pdt01} Layout 31 | } 32 | \keyword{internal} 33 | -------------------------------------------------------------------------------- /man/pdt02_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/pdt02.R 3 | \name{pdt02_lyt} 4 | \alias{pdt02_lyt} 5 | \title{\code{pdt02} Layout} 6 | \usage{ 7 | pdt02_lyt( 8 | arm_var, 9 | lbl_overall, 10 | lbl_dvreas_var, 11 | lbl_dvterm_var, 12 | dvreas_var, 13 | dvterm_var 14 | ) 15 | } 16 | \arguments{ 17 | \item{arm_var}{(\code{string}) variable used for column splitting} 18 | 19 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 20 | 21 | \item{lbl_dvreas_var}{(\code{string}) label for the variable defining the reason for deviation.} 22 | 23 | \item{lbl_dvterm_var}{(\code{string}) label for the variable defining the protocol deviation term.} 24 | 25 | \item{dvreas_var}{(\code{string}) the variable defining the reason for deviation. By default \code{DVREAS}.} 26 | 27 | \item{dvterm_var}{(\code{string}) the variable defining the protocol deviation term. By default \code{DVTERM}.} 28 | } 29 | \description{ 30 | \code{pdt02} Layout 31 | } 32 | \keyword{internal} 33 | -------------------------------------------------------------------------------- /man/postprocess.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/chevron_tlg-S4methods.R 3 | \name{postprocess} 4 | \alias{postprocess} 5 | \alias{postprocess,chevron_tlg-method} 6 | \alias{postprocess<-} 7 | \alias{postprocess<-,chevron_tlg-method} 8 | \title{Post process} 9 | \usage{ 10 | postprocess(x) 11 | 12 | \S4method{postprocess}{chevron_tlg}(x) 13 | 14 | postprocess(x) <- value 15 | 16 | \S4method{postprocess}{chevron_tlg}(x) <- value 17 | } 18 | \arguments{ 19 | \item{x}{(\code{chevron_tlg}) input.} 20 | 21 | \item{value}{(\code{function}) returning a post-processed \code{tlg}.} 22 | } 23 | \value{ 24 | the \code{function} stored in the \code{postprocess} slot of the \code{x} argument. 25 | } 26 | \description{ 27 | retrieve or set \code{postprocess} function. 28 | } 29 | -------------------------------------------------------------------------------- /man/preprocess.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/chevron_tlg-S4methods.R 3 | \name{preprocess} 4 | \alias{preprocess} 5 | \alias{preprocess,chevron_tlg-method} 6 | \alias{preprocess<-} 7 | \alias{preprocess<-,chevron_tlg-method} 8 | \title{Pre process} 9 | \usage{ 10 | preprocess(x) 11 | 12 | \S4method{preprocess}{chevron_tlg}(x) 13 | 14 | preprocess(x) <- value 15 | 16 | \S4method{preprocess}{chevron_tlg}(x) <- value 17 | } 18 | \arguments{ 19 | \item{x}{(\code{chevron_tlg}) input.} 20 | 21 | \item{value}{(\code{function}) returning a pre-processed \code{list} of \code{data.frames} amenable to \code{tlg} creation. Typically 22 | one of the \verb{_pre} function of \code{chevron}.} 23 | } 24 | \value{ 25 | the \code{function} stored in the \code{preprocess} slot of the \code{x} argument. 26 | } 27 | \description{ 28 | retrieve or set \code{preprocess} function. 29 | } 30 | -------------------------------------------------------------------------------- /man/print_args.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/chevron_tlg-S4methods.R 3 | \name{print_args} 4 | \alias{print_args} 5 | \title{Print Arguments} 6 | \usage{ 7 | print_args(run_call, additional_args, args, auto_pre = TRUE) 8 | } 9 | \description{ 10 | Print Arguments 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/print_list.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/chevron_tlg-S4methods.R 3 | \name{print_list} 4 | \alias{print_list} 5 | \title{Print list} 6 | \usage{ 7 | print_list(x, indent = 2L) 8 | } 9 | \description{ 10 | Print list 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/proportion_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{proportion_lyt} 4 | \alias{proportion_lyt} 5 | \title{Proportion layout} 6 | \usage{ 7 | proportion_lyt( 8 | lyt, 9 | arm_var, 10 | methods, 11 | strata, 12 | conf_level, 13 | odds_ratio = TRUE, 14 | rsp_var = "IS_RSP" 15 | ) 16 | } 17 | \arguments{ 18 | \item{lyt}{layout created by \code{rtables}} 19 | 20 | \item{arm_var}{(\code{string}) variable used for column splitting} 21 | 22 | \item{methods}{(\code{list}) a named list, use a named list to control, for example: 23 | \code{methods = list(prop_conf_method = "wald", diff_conf_method = "wald", strat_diff_conf_method = "ha", diff_pval_method = "fisher", strat_diff_pval_method = "schouten")} 24 | \code{prop_conf_method} controls the methods of calculating proportion confidence interval, 25 | \code{diff_conf_method} controls the methods of calculating unstratified difference confidence interval, 26 | \code{strat_diff_conf_method} controls the methods of calculating stratified difference confidence interval, 27 | \code{diff_pval_method} controls the methods of calculating unstratified p-value for odds ratio, 28 | \code{strat_diff_pval_method} controls the methods of calculating stratified p-value for odds ratio, 29 | see more details in \code{tern}} 30 | 31 | \item{strata}{(\code{string}) stratification factors, e.g. \code{strata = c("STRATA1", "STRATA2")}, by default as NULL} 32 | 33 | \item{conf_level}{(\code{numeric}) the level of confidence interval, default is 0.95.} 34 | 35 | \item{odds_ratio}{(\code{flag}) should the odds ratio be calculated, default is \code{TRUE}} 36 | } 37 | \description{ 38 | Proportion layout 39 | } 40 | \keyword{internal} 41 | -------------------------------------------------------------------------------- /man/prune_except.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{prune_except} 4 | \alias{prune_except} 5 | \title{Prune table except specified levels} 6 | \usage{ 7 | prune_except(keep) 8 | } 9 | \arguments{ 10 | \item{keep}{(\code{character}) levels to keep.} 11 | } 12 | \value{ 13 | A pruning \code{function}. 14 | } 15 | \description{ 16 | Prune table except specified levels 17 | } 18 | \keyword{internal} 19 | -------------------------------------------------------------------------------- /man/reexports.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/reexports.R 3 | \docType{import} 4 | \name{reexports} 5 | \alias{reexports} 6 | \alias{with_label} 7 | \alias{reformat} 8 | \alias{get_arg} 9 | \title{Objects exported from other packages} 10 | \keyword{internal} 11 | \description{ 12 | These objects are imported from other packages. Follow the links 13 | below to see their documentation. 14 | 15 | \describe{ 16 | \item{dunlin}{\code{\link[dunlin]{get_arg}}, \code{\link[dunlin]{reformat}}} 17 | 18 | \item{formatters}{\code{\link[formatters]{with_label}}} 19 | }} 20 | 21 | -------------------------------------------------------------------------------- /man/report_null.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/report_null.R 3 | \name{report_null} 4 | \alias{report_null} 5 | \alias{report_null,NULL-method} 6 | \alias{report_null,VTableTree-method} 7 | \alias{report_null,listing_df-method} 8 | \alias{report_null,list-method} 9 | \alias{report_null,ANY-method} 10 | \alias{standard_null_report} 11 | \title{Creates \code{NULL} Report} 12 | \usage{ 13 | report_null(tlg, ...) 14 | 15 | \S4method{report_null}{NULL}(tlg, ind = 2L, ...) 16 | 17 | \S4method{report_null}{VTableTree}(tlg, ind = 2L, ...) 18 | 19 | \S4method{report_null}{listing_df}(tlg, ind = 2L, ...) 20 | 21 | \S4method{report_null}{list}(tlg, ind = 2L, ...) 22 | 23 | \S4method{report_null}{ANY}(tlg, ...) 24 | 25 | standard_null_report() 26 | } 27 | \arguments{ 28 | \item{tlg}{to convert to null report.} 29 | 30 | \item{...}{not used.} 31 | 32 | \item{ind}{(\code{integer}) indentation for the outputs of class \code{VTableTree}.} 33 | } 34 | \value{ 35 | the \code{tlg} object or a \code{NULL} report if the \code{tlg} is \code{NULL}, is a \code{TableTree} with 0 rows, is a \code{listing_df} 36 | with 0 rows or is a \code{list} with 0 elements. 37 | } 38 | \description{ 39 | Creates \code{NULL} Report 40 | } 41 | \examples{ 42 | report_null(NULL) 43 | } 44 | -------------------------------------------------------------------------------- /man/rmpt01_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rmpt01.R 3 | \name{rmpt01_lyt} 4 | \alias{rmpt01_lyt} 5 | \title{\code{rmpt01} Layout} 6 | \usage{ 7 | rmpt01_lyt( 8 | summaryvars, 9 | lbl_summaryvars, 10 | show_tot, 11 | row_split_var, 12 | col_split_var, 13 | overall_col_lbl 14 | ) 15 | } 16 | \arguments{ 17 | \item{summaryvars}{(\code{string}) variables to be analyzed. The label attribute of the corresponding columns in \code{adex} 18 | table of \code{adam_db} is used as label.} 19 | 20 | \item{lbl_summaryvars}{(\code{character}) label associated with the analyzed variables.} 21 | 22 | \item{show_tot}{(\code{flag}) whether to display the cumulative total.} 23 | 24 | \item{row_split_var}{(\code{character}) additional row split variables.} 25 | 26 | \item{col_split_var}{(\code{string}) additional column splitting variable.} 27 | 28 | \item{overall_col_lbl}{(\code{string}) name of the overall column. If \code{NULL}, no overall level is added.} 29 | } 30 | \description{ 31 | \code{rmpt01} Layout 32 | } 33 | \keyword{internal} 34 | -------------------------------------------------------------------------------- /man/rmpt03.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rmpt03.R 3 | \docType{data} 4 | \name{rmpt03_main} 5 | \alias{rmpt03_main} 6 | \alias{rmpt03_pre} 7 | \alias{rmpt03} 8 | \title{\code{rmpt03}Duration of Exposure for Risk Management Plan Table.} 9 | \format{ 10 | An object of class \code{chevron_t} of length 1. 11 | } 12 | \usage{ 13 | rmpt03_main( 14 | adam_db, 15 | summaryvars = "AGEGR1", 16 | show_tot = TRUE, 17 | row_split_var = NULL, 18 | col_split_var = "SEX", 19 | overall_col_lbl = "All Genders", 20 | ... 21 | ) 22 | 23 | rmpt03_pre(adam_db, summaryvars = "AGEGR1", ...) 24 | 25 | rmpt03 26 | } 27 | \arguments{ 28 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 29 | 30 | \item{summaryvars}{(\code{string}) variables to be analyzed. The label attribute of the corresponding columns in \code{adex} 31 | table of \code{adam_db} is used as label.} 32 | 33 | \item{show_tot}{(\code{flag}) whether to display the cumulative total.} 34 | 35 | \item{row_split_var}{(\code{string}) the name of the column that containing variable to split exposure by.} 36 | 37 | \item{col_split_var}{(\code{string}) additional column splitting variable.} 38 | 39 | \item{overall_col_lbl}{(\code{string}) name of the overall column. If \code{NULL}, no overall level is added.} 40 | 41 | \item{...}{not used.} 42 | } 43 | \value{ 44 | the main function returns an \code{rtables} object. 45 | 46 | the preprocessing function returns a \code{list} of \code{data.frame}. 47 | } 48 | \description{ 49 | The \code{rmpt03} table provides an overview of duration of exposure. 50 | } 51 | \details{ 52 | \itemize{ 53 | \item Person time is the sum of exposure across all patients. 54 | \item Summary statistics are by default based on the number of patients in the corresponding \code{N} row 55 | (number of non-missing values). 56 | \item Does not remove zero-count rows unless overridden with \code{prune_0 = TRUE}. 57 | } 58 | } 59 | \section{Functions}{ 60 | \itemize{ 61 | \item \code{rmpt03_main()}: Main TLG function 62 | 63 | \item \code{rmpt03_pre()}: Preprocessing 64 | 65 | }} 66 | \examples{ 67 | pre_data <- dunlin::propagate(syn_data, "adsl", "AGEGR1", "USUBJID") 68 | run(rmpt03, pre_data) 69 | } 70 | \keyword{datasets} 71 | -------------------------------------------------------------------------------- /man/rmpt04.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rmpt04.R 3 | \docType{data} 4 | \name{rmpt04_main} 5 | \alias{rmpt04_main} 6 | \alias{rmpt04_pre} 7 | \alias{rmpt04} 8 | \title{\code{RMPT04}Extent of Exposure by Ethnic Origin for Risk Management Plan Table.} 9 | \format{ 10 | An object of class \code{chevron_t} of length 1. 11 | } 12 | \usage{ 13 | rmpt04_main( 14 | adam_db, 15 | summaryvars = "ETHNIC", 16 | show_tot = TRUE, 17 | row_split_var = NULL, 18 | col_split_var = NULL, 19 | overall_col_lbl = NULL, 20 | ... 21 | ) 22 | 23 | rmpt04_pre(adam_db, summaryvars = "ETHNIC", ...) 24 | 25 | rmpt04 26 | } 27 | \arguments{ 28 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 29 | 30 | \item{summaryvars}{(\code{string}) variables to be analyzed. The label attribute of the corresponding columns in \code{adex} 31 | table of \code{adam_db} is used as label.} 32 | 33 | \item{show_tot}{(\code{flag}) whether to display the cumulative total.} 34 | 35 | \item{row_split_var}{(\code{character}) additional row split variables.} 36 | 37 | \item{col_split_var}{(\code{string}) additional column splitting variable.} 38 | 39 | \item{overall_col_lbl}{(\code{string}) name of the overall column. If \code{NULL}, no overall level is added.} 40 | 41 | \item{...}{not used.} 42 | } 43 | \value{ 44 | the main function returns an \code{rtables} object. 45 | 46 | the preprocessing function returns a \code{list} of \code{data.frame}. 47 | } 48 | \description{ 49 | The \code{RMPT04} table provides an overview of duration of exposure extent. 50 | } 51 | \details{ 52 | \itemize{ 53 | \item Person time is the sum of exposure across all patients. 54 | \item Summary statistics are by default based on the number of patients in the corresponding \code{N} row 55 | (number of non-missing values). 56 | \item Does not remove zero-count rows unless overridden with \code{prune_0 = TRUE}. 57 | } 58 | } 59 | \section{Functions}{ 60 | \itemize{ 61 | \item \code{rmpt04_main()}: Main TLG function 62 | 63 | \item \code{rmpt04_pre()}: Preprocessing 64 | 65 | }} 66 | \examples{ 67 | run(rmpt04, syn_data) 68 | } 69 | \keyword{datasets} 70 | -------------------------------------------------------------------------------- /man/rmpt05.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rmpt05.R 3 | \docType{data} 4 | \name{rmpt05_main} 5 | \alias{rmpt05_main} 6 | \alias{rmpt05_pre} 7 | \alias{rmpt05} 8 | \title{\code{RMPT05} Extent of Exposure by Race for Risk Management Plan Table.} 9 | \format{ 10 | An object of class \code{chevron_t} of length 1. 11 | } 12 | \usage{ 13 | rmpt05_main( 14 | adam_db, 15 | summaryvars = "RACE", 16 | show_tot = TRUE, 17 | row_split_var = NULL, 18 | col_split_var = NULL, 19 | overall_col_lbl = NULL, 20 | ... 21 | ) 22 | 23 | rmpt05_pre(adam_db, summaryvars = "RACE", ...) 24 | 25 | rmpt05 26 | } 27 | \arguments{ 28 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 29 | 30 | \item{summaryvars}{(\code{string}) variables to be analyzed. The label attribute of the corresponding columns in \code{adex} 31 | table of \code{adam_db} is used as label.} 32 | 33 | \item{show_tot}{(\code{flag}) whether to display the cumulative total.} 34 | 35 | \item{row_split_var}{(\code{character}) additional row split variables.} 36 | 37 | \item{col_split_var}{(\code{string}) additional column splitting variable.} 38 | 39 | \item{overall_col_lbl}{(\code{string}) name of the overall column. If \code{NULL}, no overall level is added.} 40 | 41 | \item{...}{not used.} 42 | } 43 | \value{ 44 | the main function returns an \code{rtables} object. 45 | 46 | the preprocessing function returns a \code{list} of \code{data.frame}. 47 | } 48 | \description{ 49 | The \code{RMPT05} table provides an overview of duration of exposure extent. 50 | } 51 | \details{ 52 | \itemize{ 53 | \item Person time is the sum of exposure across all patients. 54 | \item Summary statistics are by default based on the number of patients in the corresponding \code{N} row 55 | (number of non-missing values). 56 | \item Does not remove zero-count rows unless overridden with \code{prune_0 = TRUE}. 57 | } 58 | } 59 | \section{Functions}{ 60 | \itemize{ 61 | \item \code{rmpt05_main()}: Main TLG function 62 | 63 | \item \code{rmpt05_pre()}: Preprocessing 64 | 65 | }} 66 | \examples{ 67 | run(rmpt05, syn_data) 68 | } 69 | \keyword{datasets} 70 | -------------------------------------------------------------------------------- /man/rmpt06_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rmpt06.R 3 | \name{rmpt06_lyt} 4 | \alias{rmpt06_lyt} 5 | \title{\code{rmpt06} Layout} 6 | \usage{ 7 | rmpt06_lyt( 8 | arm_var, 9 | lbl_overall, 10 | method, 11 | conf_level, 12 | show_diff, 13 | ref_group, 14 | method_diff, 15 | conf_level_diff, 16 | grade_groups 17 | ) 18 | } 19 | \arguments{ 20 | \item{arm_var}{(\code{string}) variable used for column splitting} 21 | 22 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 23 | } 24 | \description{ 25 | \code{rmpt06} Layout 26 | } 27 | \keyword{internal} 28 | -------------------------------------------------------------------------------- /man/rspt01_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rspt01.R 3 | \name{rspt01_lyt} 4 | \alias{rspt01_lyt} 5 | \title{\code{rspt01} Layout} 6 | \usage{ 7 | rspt01_lyt( 8 | arm_var, 9 | rsp_var, 10 | ref_group, 11 | odds_ratio, 12 | perform_analysis, 13 | strata, 14 | conf_level, 15 | methods 16 | ) 17 | } 18 | \arguments{ 19 | \item{arm_var}{(\code{string}) variable used for column splitting} 20 | } 21 | \description{ 22 | \code{rspt01} Layout 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/s_summary_na.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{s_summary_na} 4 | \alias{s_summary_na} 5 | \title{Summary factor allowing NA} 6 | \usage{ 7 | s_summary_na( 8 | x, 9 | labelstr, 10 | denom = c("n", "N_row", "N_col"), 11 | .N_row, 12 | .N_col, 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{x}{(\code{factor}) input.} 18 | 19 | \item{denom}{(\code{string}) denominator choice.} 20 | 21 | \item{.N_row}{(\code{integer}) number of rows in row-split dataset.} 22 | 23 | \item{.N_col}{(\code{integer}) number of rows in column-split dataset.} 24 | 25 | \item{...}{Not used} 26 | } 27 | \description{ 28 | Summary factor allowing NA 29 | } 30 | \keyword{internal} 31 | -------------------------------------------------------------------------------- /man/script.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/chevron_tlg-S4methods.R 3 | \name{script} 4 | \alias{script} 5 | \alias{script_funs} 6 | \alias{script_funs,chevron_tlg-method} 7 | \alias{script_funs,chevron_simple-method} 8 | \title{Create Script for \code{TLG} Generation} 9 | \usage{ 10 | script_funs(x, adam_db, args, name = deparse(substitute(x))) 11 | 12 | \S4method{script_funs}{chevron_tlg}(x, adam_db, args, name = deparse(substitute(x))) 13 | 14 | \S4method{script_funs}{chevron_simple}(x, adam_db, args, name = deparse(substitute(x))) 15 | } 16 | \arguments{ 17 | \item{x}{(\code{chevron_tlg}) input.} 18 | 19 | \item{adam_db}{(\code{string}) the name of the dataset.} 20 | 21 | \item{args}{(\code{string}) the name of argument list.} 22 | 23 | \item{name}{(\code{string}) name of the template.} 24 | } 25 | \value{ 26 | \code{character} that can be integrated into an executable script. 27 | } 28 | \description{ 29 | Create Script for \code{TLG} Generation 30 | } 31 | \examples{ 32 | script_funs(aet04, adam_db = "syn_data", args = "args") 33 | } 34 | -------------------------------------------------------------------------------- /man/set_section_div.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{set_section_div} 4 | \alias{set_section_div} 5 | \title{Set Section Dividers} 6 | \usage{ 7 | set_section_div(x) 8 | } 9 | \arguments{ 10 | \item{x}{(\code{integerish}) value of at which the section divider should be added.} 11 | } 12 | \value{ 13 | invisible \code{NULL}. Set the \code{chevron.section_div} option. 14 | } 15 | \description{ 16 | Set Section Dividers 17 | } 18 | \details{ 19 | Section dividers are empty lines between sections in tables. 20 | E.g. if 1 is used then for the first row split an empty line is added. 21 | Currently it only works for \code{aet02}, \code{cmt01a} and \code{mht01} template. 22 | } 23 | -------------------------------------------------------------------------------- /man/smart_prune.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{smart_prune} 4 | \alias{smart_prune} 5 | \title{Prune table up to an \code{ElementaryTable}} 6 | \usage{ 7 | smart_prune(tlg) 8 | } 9 | \arguments{ 10 | \item{tlg}{(\code{TableTree}) object.} 11 | } 12 | \value{ 13 | pruned \code{TableTree}. 14 | } 15 | \description{ 16 | Avoid returning \code{NULL} when the \code{table} is empty. 17 | } 18 | -------------------------------------------------------------------------------- /man/split_rows_by_recursive.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{split_rows_by_recursive} 4 | \alias{split_rows_by_recursive} 5 | \title{Count or summarize by groups} 6 | \usage{ 7 | split_rows_by_recursive(lyt, row_split_var, ...) 8 | } 9 | \arguments{ 10 | \item{lyt}{(\code{PreDataTableLayouts}) \code{rtable} layout.} 11 | 12 | \item{row_split_var}{(\code{character}) variable to split rows by.} 13 | 14 | \item{...}{Further arguments for \code{split_rows_by}} 15 | } 16 | \description{ 17 | Count or summarize by groups 18 | } 19 | \keyword{internal} 20 | -------------------------------------------------------------------------------- /man/std_listing.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{std_listing} 4 | \alias{std_listing} 5 | \title{Standard Main Listing Function} 6 | \usage{ 7 | std_listing( 8 | adam_db, 9 | dataset, 10 | key_cols, 11 | disp_cols, 12 | split_into_pages_by_var, 13 | unique_rows = FALSE, 14 | ... 15 | ) 16 | } 17 | \arguments{ 18 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 19 | 20 | \item{dataset}{(\code{string}) the name of a table in the \code{adam_db} object.} 21 | 22 | \item{key_cols}{(\code{character}) names of columns that should be treated as key columns when rendering the listing. 23 | Key columns allow you to group repeat occurrences.} 24 | 25 | \item{disp_cols}{(\code{character}) names of non-key columns which should be displayed when the listing is rendered.} 26 | 27 | \item{split_into_pages_by_var}{(\code{character} or \code{NULL}) the name of the variable to split the listing by.} 28 | 29 | \item{unique_rows}{(\code{flag}) whether to keep only unique rows in listing.} 30 | 31 | \item{...}{additional arguments passed to \code{\link[rlistings:listings]{rlistings::as_listing}}.} 32 | } 33 | \value{ 34 | the main function returns an \code{rlistings} or a \code{list} object. 35 | } 36 | \description{ 37 | Standard Main Listing Function 38 | } 39 | \keyword{internal} 40 | -------------------------------------------------------------------------------- /man/std_postprocessing.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/report_null.R 3 | \name{std_postprocessing} 4 | \alias{std_postprocessing} 5 | \title{Standard Post Processing} 6 | \usage{ 7 | std_postprocessing(tlg, ...) 8 | } 9 | \arguments{ 10 | \item{tlg}{to post process.} 11 | 12 | \item{...}{additional arguments passed to \link{report_null}.} 13 | } 14 | \value{ 15 | a processed \code{tlg} or a null report. 16 | } 17 | \description{ 18 | Standard Post Processing 19 | } 20 | \examples{ 21 | library(rtables) 22 | std_postprocessing(build_table(basic_table() |> analyze("Species"), iris), ind = 10L) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /man/summarize_vars_allow_na.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/rtables_utils.R 3 | \name{summarize_vars_allow_na} 4 | \alias{summarize_vars_allow_na} 5 | \title{Summarize variables allow \code{NA}} 6 | \usage{ 7 | summarize_vars_allow_na( 8 | lyt, 9 | vars, 10 | var_labels = vars, 11 | nested = TRUE, 12 | ..., 13 | show_labels = "default", 14 | table_names = vars, 15 | section_div = NA_character_, 16 | .stats = c("n", "count_fraction"), 17 | .formats = list(count_fraction = format_count_fraction_fixed_dp), 18 | .labels = NULL, 19 | .indent_mods = NULL, 20 | inclNAs = TRUE 21 | ) 22 | } 23 | \description{ 24 | Summarize variables allow \code{NA} 25 | } 26 | \keyword{internal} 27 | -------------------------------------------------------------------------------- /man/syn_data.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{syn_data} 5 | \alias{syn_data} 6 | \title{Example \code{adam} Synthetic Data} 7 | \format{ 8 | A named \code{list} of 13 \code{data.frames}: 9 | - \code{adsl} 10 | - \code{adae} 11 | - \code{adsaftte} 12 | - \code{adcm} 13 | - \code{addv} 14 | - \code{adeg} 15 | - \code{adex} 16 | - \code{adlb} 17 | - \code{admh} 18 | - \code{adrs} 19 | - \code{adsub} 20 | - \code{adtte} 21 | - \code{advs} 22 | } 23 | \source{ 24 | based on package \code{random.cdisc.data} 25 | } 26 | \usage{ 27 | syn_data 28 | } 29 | \description{ 30 | Example \code{adam} Synthetic Data 31 | } 32 | \keyword{datasets} 33 | -------------------------------------------------------------------------------- /man/ttet01_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ttet01.R 3 | \name{ttet01_lyt} 4 | \alias{ttet01_lyt} 5 | \title{\code{ttet01} Layout} 6 | \usage{ 7 | ttet01_lyt( 8 | arm_var, 9 | ref_group, 10 | summarize_event, 11 | perform_analysis, 12 | strata, 13 | timeunit, 14 | event_lvls, 15 | control_survt, 16 | control_cox_ph, 17 | control_survtp, 18 | ... 19 | ) 20 | } 21 | \arguments{ 22 | \item{arm_var}{(\code{string}) variable used for column splitting} 23 | 24 | \item{timeunit}{(\code{string}) time unit get from \code{AVALU}, by default is \code{"Months"}} 25 | 26 | \item{...}{not used.} 27 | } 28 | \description{ 29 | \code{ttet01} Layout 30 | } 31 | \keyword{internal} 32 | -------------------------------------------------------------------------------- /man/unwrap_layout.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/unwrap.R 3 | \name{unwrap_layout} 4 | \alias{unwrap_layout} 5 | \title{Extracting Layout Function.} 6 | \usage{ 7 | unwrap_layout(x, pattern = "_lyt$") 8 | } 9 | \arguments{ 10 | \item{x}{(\code{function}) containing a call to a layout function.} 11 | 12 | \item{pattern}{(\code{string}) identifying layout functions} 13 | } 14 | \value{ 15 | invisible \code{NULL} and print the content of the layout functions found in the body of \code{x}. 16 | } 17 | \description{ 18 | Extracting Layout Function. 19 | } 20 | \examples{ 21 | unwrap_layout(aet01_main) 22 | 23 | } 24 | \keyword{internal} 25 | -------------------------------------------------------------------------------- /man/var_labels_for.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/utils.R 3 | \name{var_labels_for} 4 | \alias{var_labels_for} 5 | \title{Retrieve labels for certain variables} 6 | \usage{ 7 | var_labels_for(df, vars) 8 | } 9 | \arguments{ 10 | \item{df}{(\code{data.frame}) containing columns with label attribute.} 11 | 12 | \item{vars}{(\code{character}) variable names in \code{df}.} 13 | } 14 | \value{ 15 | a \code{character} with replaced placeholders and a \code{label} attribute. 16 | } 17 | \description{ 18 | Retrieve labels for certain variables 19 | } 20 | \details{ 21 | The labels will be returned if the column has \code{label} attribute, otherwise the column name will be returned. 22 | Any values between brackets {} will be replaced with \code{dunlin::render_safe}. 23 | } 24 | -------------------------------------------------------------------------------- /man/vst02_1.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/vst02.R 3 | \docType{data} 4 | \name{vst02_1_main} 5 | \alias{vst02_1_main} 6 | \alias{vst02_pre} 7 | \alias{vst02_post} 8 | \alias{vst02_1} 9 | \title{\code{VST02} Vital Sign Abnormalities Table.} 10 | \format{ 11 | An object of class \code{chevron_t} of length 1. 12 | } 13 | \usage{ 14 | vst02_1_main( 15 | adam_db, 16 | arm_var = "ACTARM", 17 | lbl_overall = NULL, 18 | exclude_base_abn = FALSE, 19 | ... 20 | ) 21 | 22 | vst02_pre(adam_db, ...) 23 | 24 | vst02_post(tlg, prune_0 = FALSE, ...) 25 | 26 | vst02_1 27 | } 28 | \arguments{ 29 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 30 | 31 | \item{arm_var}{(\code{string}) variable used for column splitting} 32 | 33 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 34 | 35 | \item{exclude_base_abn}{(\code{flag}) whether baseline abnormality should be excluded.} 36 | 37 | \item{...}{not used.} 38 | 39 | \item{tlg}{(\code{TableTree}, \code{Listing} or \code{ggplot}) object typically produced by a \code{main} function.} 40 | 41 | \item{prune_0}{(\code{flag}) remove 0 count rows} 42 | } 43 | \value{ 44 | the main function returns an \code{rtables} object. 45 | 46 | the preprocessing function returns a \code{list} of \code{data.frame}. 47 | 48 | the postprocessing function returns an \code{rtables} object or an \code{ElementaryTable} (null report). 49 | } 50 | \description{ 51 | Vital Sign Parameters outside Normal Limits Regardless of Abnormality at Baseline. 52 | } 53 | \details{ 54 | \itemize{ 55 | \item Only count LOW or HIGH values. 56 | \item Results of "LOW LOW" are treated as the same as "LOW", and "HIGH HIGH" the same as "HIGH". 57 | \item Does not include a total column by default. 58 | \item Does not remove zero-count rows unless overridden with \code{prune_0 = TRUE}. 59 | } 60 | } 61 | \section{Functions}{ 62 | \itemize{ 63 | \item \code{vst02_1_main()}: Main TLG function 64 | 65 | \item \code{vst02_pre()}: Preprocessing 66 | 67 | \item \code{vst02_post()}: Postprocessing 68 | 69 | }} 70 | \note{ 71 | \itemize{ 72 | \item \code{adam_db} object must contain an \code{advs} table with the \code{"PARAM"}, \code{"ANRIND"} and \code{"BNRIND"} columns. 73 | } 74 | } 75 | \examples{ 76 | run(vst02_1, syn_data) 77 | } 78 | \keyword{datasets} 79 | -------------------------------------------------------------------------------- /man/vst02_2.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/vst02.R 3 | \docType{data} 4 | \name{vst02_2_main} 5 | \alias{vst02_2_main} 6 | \alias{vst02_2} 7 | \title{\code{VST02} Vital Sign Abnormalities Table.} 8 | \format{ 9 | An object of class \code{chevron_t} of length 1. 10 | } 11 | \usage{ 12 | vst02_2_main( 13 | adam_db, 14 | arm_var = "ACTARM", 15 | lbl_overall = NULL, 16 | exclude_base_abn = TRUE, 17 | ... 18 | ) 19 | 20 | vst02_2 21 | } 22 | \arguments{ 23 | \item{adam_db}{(\code{list} of \code{data.frames}) object containing the \code{ADaM} datasets} 24 | 25 | \item{arm_var}{(\code{string}) variable used for column splitting} 26 | 27 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 28 | 29 | \item{exclude_base_abn}{(\code{flag}) whether baseline abnormality should be excluded.} 30 | 31 | \item{...}{not used.} 32 | } 33 | \value{ 34 | the main function returns an \code{rtables} object. 35 | 36 | the preprocessing function returns a \code{list} of \code{data.frame}. 37 | 38 | the postprocessing function returns an \code{rtables} object or an \code{ElementaryTable} (null report). 39 | } 40 | \description{ 41 | Vital Sign Parameters outside Normal Limits Among Patients without Abnormality at Baseline. 42 | } 43 | \details{ 44 | \itemize{ 45 | \item Only count LOW or HIGH values. 46 | \item Results of "LOW LOW" are treated as the same as "LOW", and "HIGH HIGH" the same as "HIGH". 47 | \item Does not include a total column by default. 48 | \item Does not remove zero-count rows unless overridden with \code{prune_0 = TRUE}. 49 | } 50 | } 51 | \section{Functions}{ 52 | \itemize{ 53 | \item \code{vst02_2_main()}: Main TLG function 54 | 55 | }} 56 | \note{ 57 | \itemize{ 58 | \item \code{adam_db} object must contain an \code{advs} table with the \code{"PARAM"}, \code{"ANRIND"} and \code{"BNRIND"} columns. 59 | } 60 | } 61 | \examples{ 62 | run(vst02_2, syn_data) 63 | } 64 | \keyword{datasets} 65 | -------------------------------------------------------------------------------- /man/vst02_lyt.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/vst02.R 3 | \name{vst02_lyt} 4 | \alias{vst02_lyt} 5 | \title{\code{vst02_1} Layout} 6 | \usage{ 7 | vst02_lyt( 8 | arm_var, 9 | lbl_overall, 10 | exclude_base_abn, 11 | lbl_vs_assessment, 12 | lbl_vs_abnormality 13 | ) 14 | } 15 | \arguments{ 16 | \item{arm_var}{(\code{string}) variable used for column splitting} 17 | 18 | \item{lbl_overall}{(\code{string}) label used for overall column, if set to \code{NULL} the overall column is omitted} 19 | 20 | \item{exclude_base_abn}{(\code{flag}) whether to exclude subjects with baseline abnormality from numerator and 21 | denominator.} 22 | 23 | \item{lbl_vs_assessment}{(\code{string}) the label of the assessment variable.} 24 | 25 | \item{lbl_vs_abnormality}{(\code{string}) the label of the abnormality variable.} 26 | } 27 | \description{ 28 | \code{vst02_1} Layout 29 | } 30 | \keyword{internal} 31 | -------------------------------------------------------------------------------- /man/yes_no_rule.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/standard_rules.R 3 | \docType{data} 4 | \name{yes_no_rule} 5 | \alias{yes_no_rule} 6 | \title{Yes/No rule in title case} 7 | \format{ 8 | An object of class \code{rule} (inherits from \code{character}) of length 8. 9 | } 10 | \usage{ 11 | yes_no_rule 12 | } 13 | \description{ 14 | Yes/No rule in title case 15 | } 16 | \keyword{datasets} 17 | -------------------------------------------------------------------------------- /revdep/.gitignore: -------------------------------------------------------------------------------- 1 | checks 2 | library 3 | checks.noindex 4 | library.noindex 5 | cloud.noindex 6 | data.sqlite 7 | *.html 8 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | # This file is part of the standard setup for testthat. 2 | # It is recommended that you do not modify it. 3 | # 4 | # Where should you do additional test configuration? 5 | # Learn more about the roles of various files in: 6 | # * https://r-pkgs.org/tests.html 7 | # * https://testthat.r-lib.org/reference/test_package.html#special-files 8 | 9 | library(testthat) 10 | library(checkmate) 11 | library(chevron) 12 | 13 | test_check("chevron") 14 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/aet10.md: -------------------------------------------------------------------------------- 1 | # aet10 can handle NA values 2 | 3 | Code 4 | cat(export_as_txt(res, lpp = 100)) 5 | Output 6 | A: Drug X B: Placebo C: Combination 7 | MedDRA Preferred Term (N=15) (N=15) (N=15) 8 | ———————————————————————————————————————————————————————————————— 9 | No Coding Available 13 (86.7%) 14 (93.3%) 15 (100%) 10 | 11 | # aet10 can handle some NA values 12 | 13 | Code 14 | cat(export_as_txt(res, lpp = 100)) 15 | Output 16 | A: Drug X B: Placebo C: Combination 17 | MedDRA Preferred Term (N=15) (N=15) (N=15) 18 | ——————————————————————————————————————————————————————————————— 19 | dcd B.2.2.3.1 8 (53.3%) 6 (40.0%) 7 (46.7%) 20 | dcd B.1.1.1.1 5 (33.3%) 6 (40.0%) 8 (53.3%) 21 | dcd C.2.1.2.1 6 (40.0%) 4 (26.7%) 8 (53.3%) 22 | dcd A.1.1.1.2 5 (33.3%) 6 (40.0%) 6 (40.0%) 23 | dcd B.2.1.2.1 5 (33.3%) 6 (40.0%) 5 (33.3%) 24 | dcd D.1.1.1.1 4 (26.7%) 4 (26.7%) 7 (46.7%) 25 | dcd D.1.1.4.2 5 (33.3%) 2 (13.3%) 7 (46.7%) 26 | dcd D.2.1.5.3 2 (13.3%) 5 (33.3%) 7 (46.7%) 27 | dcd C.1.1.1.3 3 (20.0%) 4 (26.7%) 5 (33.3%) 28 | dcd A.1.1.1.1 3 (20.0%) 1 (6.7%) 6 (40.0%) 29 | No Coding Available 1 (6.7%) 0 0 30 | 31 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/egt02.md: -------------------------------------------------------------------------------- 1 | # egt02_1 functions with default argument value return expected result with test data 2 | 3 | Code 4 | cat(export_as_txt(res, lpp = 100)) 5 | Output 6 | Assessment A: Drug X B: Placebo C: Combination 7 | Abnormality (N=15) (N=15) (N=15) 8 | ——————————————————————————————————————————————————————————— 9 | Heart Rate 10 | Low 4/15 (26.7%) 4/15 (26.7%) 4/15 (26.7%) 11 | High 4/15 (26.7%) 3/15 (20%) 3/15 (20%) 12 | QT Duration 13 | Low 2/15 (13.3%) 5/15 (33.3%) 3/15 (20%) 14 | High 3/15 (20%) 6/15 (40%) 2/15 (13.3%) 15 | RR Duration 16 | Low 6/15 (40%) 2/15 (13.3%) 4/15 (26.7%) 17 | High 4/15 (26.7%) 5/15 (33.3%) 2/15 (13.3%) 18 | 19 | # egt02_2 functions with default value return expected result with test data 20 | 21 | Code 22 | cat(export_as_txt(res, lpp = 100)) 23 | Output 24 | Assessment A: Drug X B: Placebo C: Combination 25 | Abnormality (N=15) (N=15) (N=15) 26 | ——————————————————————————————————————————————————————————— 27 | Heart Rate 28 | Low 4/15 (26.7%) 4/14 (28.6%) 4/15 (26.7%) 29 | High 3/13 (23.1%) 3/15 (20%) 2/14 (14.3%) 30 | QT Duration 31 | Low 2/12 (16.7%) 5/15 (33.3%) 3/14 (21.4%) 32 | High 3/14 (21.4%) 6/15 (40%) 2/14 (14.3%) 33 | RR Duration 34 | Low 6/15 (40%) 2/13 (15.4%) 4/14 (28.6%) 35 | High 4/13 (30.8%) 5/13 (38.5%) 2/15 (13.3%) 36 | 37 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/utils.md: -------------------------------------------------------------------------------- 1 | # ifneeded_split_row works as expected 2 | 3 | Code 4 | res1 5 | Output 6 | setosa versicolor virginica All 7 | ———————————————————————————————————————— 8 | 9 | --- 10 | 11 | Code 12 | res2 13 | Output 14 | setosa versicolor virginica 15 | —————————————————————————————————— 16 | 17 | --- 18 | 19 | Code 20 | res3 21 | Output 22 | setosa versicolor virginica 23 | —————————————————————————————————— 24 | 25 | --- 26 | 27 | Code 28 | res4 29 | Output 30 | all obs 31 | —————————— 32 | 33 | -------------------------------------------------------------------------------- /tests/testthat/setup-options.R: -------------------------------------------------------------------------------- 1 | # `opts_partial_match_old` is left for exclusions due to partial matching in dependent packages (i.e. not fixable here) 2 | # it might happen that it is not used right now, but it is left for possible future use 3 | # use with: `withr::with_options(opts_partial_match_old, { ... })` inside the test 4 | opts_partial_match_old <- list( 5 | warnPartialMatchDollar = getOption("warnPartialMatchDollar"), 6 | warnPartialMatchArgs = getOption("warnPartialMatchArgs"), 7 | warnPartialMatchAttr = getOption("warnPartialMatchAttr") 8 | ) 9 | opts_partial_match_new <- list( 10 | warnPartialMatchDollar = TRUE, 11 | warnPartialMatchArgs = TRUE, 12 | warnPartialMatchAttr = TRUE 13 | ) 14 | 15 | if (isFALSE(getFromNamespace("on_cran", "testthat")()) && requireNamespace("withr", quietly = TRUE)) { 16 | withr::local_options( 17 | opts_partial_match_new, 18 | .local_envir = testthat::teardown_env() 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /tests/testthat/test-ael02.R: -------------------------------------------------------------------------------- 1 | # ael02 ---- 2 | 3 | test_that("ael02 works with adae dataset", { 4 | res <- expect_silent( 5 | run(ael02, syn_data, dataset = "adae") 6 | ) 7 | expect_list(res, len = 3) 8 | res <- lapply(res, "[", 1:10, ) 9 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 110))) 10 | }) 11 | 12 | test_that("ael02 can handle all missing values", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | proc_data$adae <- proc_data$adae %>% 16 | mutate( 17 | AEDECOD = NA_character_, 18 | ACTARM = NA_character_, 19 | ASEV = NA_character_ 20 | ) 21 | 22 | res <- expect_silent(run(ael02, proc_data)) 23 | expect_list(res, len = 1) 24 | expect_snapshot(cat(export_as_txt(res[[1]][1:50, ], lpp = 100, cpp = 110))) 25 | }) 26 | 27 | # ael02 functions ---- 28 | 29 | 30 | test_that("ael02 functions work as expected", { 31 | skip_on_os("windows") 32 | res <- expect_silent( 33 | ael02_pre(syn_data) %>% 34 | ael02_main() 35 | ) 36 | 37 | expect_list(res, len = 3) 38 | res <- lapply(res, "[", 1:10, ) 39 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 110))) 40 | }) 41 | -------------------------------------------------------------------------------- /tests/testthat/test-ael03.R: -------------------------------------------------------------------------------- 1 | # ael03 ---- 2 | 3 | test_that("ael03 works with adae dataset", { 4 | res <- expect_silent( 5 | run(ael03, syn_data, dataset = "adae") 6 | ) 7 | expect_list(res, len = 3) 8 | res <- lapply(res, "[", 1:10, ) 9 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 110))) 10 | }) 11 | 12 | test_that("ael03 can handle all missing values", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | proc_data$adae <- proc_data$adae %>% 16 | mutate( 17 | AEDECOD = NA_character_, 18 | ACTARM = NA_character_, 19 | ASEV = NA_character_ 20 | ) 21 | 22 | res <- expect_silent(run(ael03, proc_data)) 23 | expect_list(res, len = 1) 24 | 25 | expect_snapshot(cat(export_as_txt(res[[1]][1:50, ], lpp = 100, cpp = 110))) 26 | }) 27 | 28 | # ael03 functions ---- 29 | 30 | test_that("ael03 functions work as expected", { 31 | skip_on_os("windows") 32 | res <- expect_silent( 33 | ael03_pre(syn_data) %>% 34 | ael03_main() 35 | ) 36 | 37 | expect_list(res, len = 3) 38 | res <- lapply(res, "[", 1:10, ) 39 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 110))) 40 | }) 41 | -------------------------------------------------------------------------------- /tests/testthat/test-aet01.R: -------------------------------------------------------------------------------- 1 | # aet01 ---- 2 | 3 | test_that("aet01 can handle all NA values", { 4 | proc_data <- syn_data 5 | proc_data$adae <- proc_data$adae %>% 6 | mutate( 7 | AESDTH = NA, 8 | AESER = NA 9 | ) 10 | 11 | res <- expect_silent(run(aet01, proc_data)) 12 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 13 | res <- expect_silent(run(aet01, proc_data, prune_0 = TRUE)) 14 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 15 | }) 16 | 17 | test_that("aet01 can handle some NA values", { 18 | skip_on_os("windows") 19 | new_aesdth <- c(NA, "", as.character(syn_data$adae$AESDTH[-c(1, 2)])) 20 | new_aeser <- c(NA, "", as.character(syn_data$adae$AESER[-c(1, 2)])) 21 | 22 | proc_data <- syn_data 23 | proc_data$adae <- proc_data$adae %>% 24 | mutate( 25 | AESDTH = .env$new_aesdth, 26 | AESER = .env$new_aeser 27 | ) 28 | 29 | res <- expect_silent(run(aet01, proc_data)) 30 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 31 | }) 32 | 33 | test_that("aet01 can use custom anl_vars", { 34 | skip_on_os("windows") 35 | proc_data <- syn_data 36 | res <- expect_silent(run(aet01, proc_data, anl_vars = list(safety_var = "FATAL"))) 37 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 38 | }) 39 | 40 | test_that("aet01 fails on incomplete data input", { 41 | skip_on_os("windows") 42 | proc_data <- syn_data 43 | proc_data$adae <- proc_data$adae %>% 44 | mutate(AESER = NULL) 45 | 46 | expect_error( 47 | run(aet01, proc_data), 48 | "Column `AESER` not found", 49 | fixed = TRUE 50 | ) 51 | }) 52 | 53 | test_that("aet01 can use custom medconcept_var", { 54 | skip_on_os("windows") 55 | proc_data <- syn_data 56 | proc_data$adae$SMQ01 <- with_label(proc_data$adae$SMQ01NAM != "", "SMQ 01") 57 | res <- expect_silent( 58 | run( 59 | aet01, proc_data, 60 | anl_vars = list( 61 | safety_var = c( 62 | "FATAL", "SER", "SERWD", "SERDSM", 63 | "RELSER", "WD", "DSM", "REL", "RELWD", "RELDSM", "SEV" 64 | ), 65 | medconcept = "SMQ01" 66 | ) 67 | ) 68 | ) 69 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 70 | }) 71 | 72 | test_that("aet01 can conditionally show the number of withdrawal", { 73 | skip_on_os("windows") 74 | expect_silent(res <- run(aet01, syn_data, arm_var = "ARM", show_wd = FALSE)) 75 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 76 | }) 77 | -------------------------------------------------------------------------------- /tests/testthat/test-aet01_aesi.R: -------------------------------------------------------------------------------- 1 | # aet01_aesi ---- 2 | 3 | test_that("aet01_aesi can handle all NA values", { 4 | proc_data <- syn_data 5 | proc_data$adae <- proc_data$adae %>% 6 | mutate( 7 | AETOXGR = factor(NA, levels = 1:5), 8 | ALL_RESOLVED = NA, 9 | NOT_RESOLVED = NA, 10 | AEACN = NA, 11 | AECONTRT = NA, 12 | AEREL = NA, 13 | AESER = NA 14 | ) 15 | 16 | res <- expect_silent(run(aet01_aesi, proc_data)) 17 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 200))) 18 | res <- expect_silent(run(aet01_aesi, proc_data, prune_0 = TRUE)) 19 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 200))) 20 | }) 21 | 22 | test_that("aet01_aesi can handle some NA values", { 23 | skip_on_os("windows") 24 | proc_data <- syn_data 25 | proc_data$adae <- proc_data$adae %>% 26 | mutate( 27 | AEACN = c(NA, as.character(syn_data$adae$AEACN)[-1]) 28 | ) 29 | 30 | res <- expect_silent(run(aet01_aesi, proc_data)) 31 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 200))) 32 | }) 33 | 34 | test_that("aet01_aesi works with `ALL` argument", { 35 | skip_on_os("windows") 36 | proc_data <- syn_data 37 | res <- expect_silent(run(aet01_aesi, proc_data, aesi_vars = c("ALL"))) 38 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 200))) 39 | }) 40 | 41 | test_that("aet01_aesi_check fails on incomplete data input", { 42 | skip_on_os("windows") 43 | proc_data <- syn_data 44 | proc_data$adae <- proc_data$adae %>% 45 | mutate(AEOUT = NULL) 46 | 47 | expect_error( 48 | run(aet01_aesi, proc_data, aesi_vars = c("ALL")), 49 | "Column `AEOUT` not found in", 50 | fixed = TRUE 51 | ) 52 | }) 53 | -------------------------------------------------------------------------------- /tests/testthat/test-aet02.R: -------------------------------------------------------------------------------- 1 | # aet02 ---- 2 | 3 | test_that("aet02 fails on incomplete data input", { 4 | proc_data <- syn_data 5 | proc_data$adae <- proc_data$adae %>% 6 | mutate( 7 | AEDECOD = NULL 8 | ) 9 | 10 | expect_error( 11 | run(aet02, proc_data), 12 | "Column `AEDECOD` not found", 13 | fixed = TRUE 14 | ) 15 | }) 16 | 17 | test_that("aet02 handle empty data input", { 18 | skip_on_os("windows") 19 | proc_data <- syn_data 20 | proc_data$adae <- proc_data$adae %>% 21 | filter( 22 | AEDECOD == "" 23 | ) 24 | 25 | expect_silent(run(aet02, proc_data)) 26 | }) 27 | 28 | test_that("aet02 can have different levels of row_split", { 29 | skip_on_os("windows") 30 | res1 <- run(aet02, syn_data, row_split_var = NULL) 31 | res2 <- run(aet02, syn_data, row_split_var = c("AEBODSYS", "AEDECOD")) 32 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 33 | expect_snapshot(cat(export_as_txt(res2, lpp = 100))) 34 | }) 35 | -------------------------------------------------------------------------------- /tests/testthat/test-aet03.R: -------------------------------------------------------------------------------- 1 | test_that("aet03 can handle NA values", { 2 | proc_data <- syn_data 3 | proc_data$adae <- proc_data$adae %>% 4 | mutate( 5 | AEBODSYS = with_label(NA_character_, var_labels_for(syn_data$adae, "AEBODSYS")), 6 | AEDECOD = with_label(NA_character_, var_labels_for(syn_data$adae, "AEDECOD")) 7 | ) 8 | 9 | res1 <- expect_silent(run(aet03, proc_data)) 10 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 11 | }) 12 | 13 | test_that("aet03 can handle some NA values", { 14 | skip_on_os("windows") 15 | new_aebodsys <- c(NA, "", as.character(syn_data$adae$AEBODSYS[-c(1, 2)])) 16 | new_aedecod <- c(NA, "", as.character(syn_data$adae$AEDECOD[-c(1, 2)])) 17 | new_asev <- c(NA, "", as.character(syn_data$adae$ASEV[-c(1, 2)])) 18 | 19 | proc_data <- syn_data 20 | proc_data$adae <- proc_data$adae %>% 21 | mutate( 22 | AEBODSYS = with_label(.env$new_aebodsys, var_labels_for(syn_data$adae, "AEBODSYS")), 23 | AEDECOD = with_label(.env$new_aedecod, var_labels_for(syn_data$adae, "AEDECOD")), 24 | ASEV = .env$new_asev 25 | ) 26 | 27 | res1 <- expect_silent(run(aet03, proc_data)) 28 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 29 | }) 30 | -------------------------------------------------------------------------------- /tests/testthat/test-aet04.R: -------------------------------------------------------------------------------- 1 | test_that("aet04 can handle NA values", { 2 | proc_data <- syn_data 3 | proc_data$adae <- proc_data$adae %>% 4 | mutate( 5 | AEBODSYS = with_label(NA_character_, var_labels_for(syn_data$adae, "AEBODSYS")), 6 | AEDECOD = with_label(NA_character_, var_labels_for(syn_data$adae, "AEDECOD")) 7 | ) 8 | 9 | res1 <- expect_silent(run(aet04, proc_data)) 10 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 11 | skip_on_os("windows") 12 | grade_groups <- list( 13 | "Grade 1-2" = c("1", "2"), 14 | "Grade 3-4" = c("3", "4"), 15 | "Grade 5" = c("5") 16 | ) 17 | res2 <- expect_silent(run(aet04, proc_data, grade_groups = grade_groups)) 18 | expect_identical(res1, res2) 19 | 20 | grade_groups <- list( 21 | "Grade 1-2" = c("1", "2"), 22 | "Grade 3-5" = c("3", "4", "5") 23 | ) 24 | res3 <- expect_silent(run(aet04, proc_data, grade_groups = grade_groups)) 25 | expect_snapshot(cat(export_as_txt(res3, lpp = 100))) 26 | }) 27 | 28 | test_that("aet04 can handle some NA values", { 29 | skip_on_os("windows") 30 | proc_data <- syn_data 31 | proc_data$adae[1:2, c("AEBODSYS", "AEDECOD")] <- NA 32 | res1 <- expect_silent(run(aet04, proc_data)) 33 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 34 | 35 | grade_groups <- list( 36 | "Grade 1-2" = c("1", "2"), 37 | "Grade 3-4" = c("3", "4"), 38 | "Grade 5" = c("5") 39 | ) 40 | res2 <- expect_silent(run(aet04, proc_data, grade_groups = grade_groups)) 41 | expect_identical(res1, res2) 42 | 43 | grade_groups <- list( 44 | "Grade 1-2" = c("1", "2"), 45 | "Grade 3-5" = c("3", "4", "5") 46 | ) 47 | res3 <- expect_silent(run(aet04, proc_data, grade_groups = grade_groups)) 48 | expect_snapshot(cat(export_as_txt(res3, lpp = 100))) 49 | }) 50 | -------------------------------------------------------------------------------- /tests/testthat/test-aet05.R: -------------------------------------------------------------------------------- 1 | test_that("aet05 can handle NA values", { 2 | proc_data <- syn_data 3 | proc_data$adsaftte$AVAL <- NA_real_ 4 | proc_data$adsaftte$CNSR <- NA_real_ 5 | 6 | res <- expect_silent(run(aet05, proc_data)) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | test_that("aet05 can handle some NA values", { 11 | skip_on_os("windows") 12 | new_paramcd <- c( 13 | as.character(syn_data$adsaftte$PARAMCD[1:4]), NA, "", 14 | as.character(syn_data$adsaftte$PARAMCD[-rep(1:6)]) 15 | ) 16 | 17 | proc_data <- syn_data 18 | 19 | proc_data$adsaftte <- proc_data$adsaftte %>% 20 | mutate( 21 | PARAMCD = with_label(.env$new_paramcd, var_labels_for(syn_data$adsaftte, "PARAMCD")) 22 | ) 23 | 24 | res1 <- expect_silent(run(aet05, proc_data)) 25 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 26 | 27 | res2 <- expect_silent(run(aet05, proc_data, conf_level = 0.90, conf_type = "byar")) 28 | expect_snapshot(cat(export_as_txt(res2, lpp = 100))) 29 | }) 30 | -------------------------------------------------------------------------------- /tests/testthat/test-aet05_all.R: -------------------------------------------------------------------------------- 1 | test_that("aet05_all can handle NA values", { 2 | proc_data <- syn_data 3 | proc_data$adsaftte$AVAL <- NA_real_ 4 | proc_data$adsaftte$CNSR <- NA_real_ 5 | 6 | res <- expect_silent(run(aet05_all, proc_data)) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | test_that("aet05_all can handle some NA values", { 11 | skip_on_os("windows") 12 | new_paramcd <- c(NA, "", as.character(syn_data$adsaftte$PARAMCD[-c(1, 2)])) 13 | 14 | proc_data <- syn_data 15 | 16 | proc_data$adsaftte <- proc_data$adsaftte %>% 17 | mutate( 18 | PARAMCD = with_label(.env$new_paramcd, var_labels_for(syn_data$adsaftte, "PARAMCD")) 19 | ) 20 | 21 | res1 <- expect_silent(run(aet05_all, proc_data)) 22 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 23 | 24 | res2 <- expect_silent(run(aet05_all, proc_data, conf_level = 0.90, conf_type = "byar")) 25 | expect_snapshot(cat(export_as_txt(res2, lpp = 100))) 26 | }) 27 | -------------------------------------------------------------------------------- /tests/testthat/test-aet10.R: -------------------------------------------------------------------------------- 1 | test_that("aet10 can handle NA values", { 2 | proc_data <- syn_data 3 | 4 | proc_data$adae <- proc_data$adae %>% 5 | mutate( 6 | AEDECOD = with_label(NA_character_, var_labels_for(syn_data$adae, "AEDECOD")) 7 | ) 8 | 9 | res <- expect_silent(run(aet10, proc_data)) 10 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 11 | }) 12 | 13 | test_that("aet10 can handle some NA values", { 14 | skip_on_os("windows") 15 | new_aedecod <- c(NA, "", as.character(syn_data$adae$AEDECOD[-c(1, 2)])) 16 | 17 | proc_data <- syn_data 18 | 19 | proc_data$adae <- proc_data$adae %>% 20 | mutate( 21 | AEDECOD = with_label(.env$new_aedecod, var_labels_for(syn_data$adae, "AEDECOD")) 22 | ) 23 | 24 | res <- expect_silent(run(aet10, proc_data)) 25 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 26 | }) 27 | -------------------------------------------------------------------------------- /tests/testthat/test-cfbt01.R: -------------------------------------------------------------------------------- 1 | # cfbt01 functions ---- 2 | 3 | test_that("cfbt01 functions with default argument value return expected result with test data", { 4 | skip_on_os("windows") 5 | pre_data <- cfbt01_pre(syn_data, dataset = "advs") 6 | raw_res <- cfbt01_main(pre_data, dataset = "advs") 7 | res <- cfbt01_post(raw_res) 8 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 9 | }) 10 | 11 | # cfbt01 ---- 12 | 13 | test_that("cfbt01 can handle n = 0 and outputs NE instead of infs and NAs", { 14 | skip_on_os("windows") 15 | proc_data <- dunlin::log_filter( 16 | syn_data, 17 | PARAMCD %in% c("DIABP", "SYSBP"), "advs" 18 | ) 19 | 20 | res <- expect_silent( 21 | run(cfbt01, proc_data, dataset = "advs") 22 | ) 23 | 24 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 25 | }) 26 | -------------------------------------------------------------------------------- /tests/testthat/test-checks.R: -------------------------------------------------------------------------------- 1 | # check_all_colnames ---- 2 | 3 | test_that("check_all_colnames works as expected", { 4 | res <- expect_silent(check_all_colnames(mtcars, c("x", "y"))) 5 | expect_identical(res, " Expected column names: x, y not in mtcars") 6 | 7 | res <- expect_silent(check_all_colnames(mtcars, c("mpg"))) 8 | expect_null(res) 9 | }) 10 | 11 | # check_one_colnames ---- 12 | 13 | test_that("check_one_colnames works as expected", { 14 | res <- expect_silent(check_one_colnames(mtcars, c("x", "y"))) 15 | expect_identical(res, " At least one of: x, y is expected to be a column name of mtcars") 16 | 17 | res <- expect_silent(check_one_colnames(mtcars, c("mpg", "x"))) 18 | expect_null(res) 19 | }) 20 | -------------------------------------------------------------------------------- /tests/testthat/test-cml02a_gl.R: -------------------------------------------------------------------------------- 1 | # cml02a_gl ---- 2 | 3 | test_that("cml02a_gl works with adcm dataset", { 4 | expect_silent(res <- run(cml02a_gl, syn_data)) 5 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 110))) 6 | }) 7 | 8 | test_that("cml02a_gl works with missing data", { 9 | skip_on_os("windows") 10 | proc_data <- syn_data 11 | proc_data$adcm$ATC2 <- NA_character_ 12 | expect_silent(res <- run(cml02a_gl, proc_data)) 13 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 110))) 14 | }) 15 | 16 | # cml02a_gl functions ---- 17 | 18 | test_that("cml02a_gl functions work as expected", { 19 | skip_on_os("windows") 20 | expect_silent( 21 | res <- cml02a_gl_pre(syn_data) %>% 22 | cml02a_gl_main() 23 | ) 24 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 110))) 25 | }) 26 | -------------------------------------------------------------------------------- /tests/testthat/test-cmt01a.R: -------------------------------------------------------------------------------- 1 | # cmt01a functions ---- 2 | 3 | test_that("cmt01a functions with default argument value return expected result with test data", { 4 | pre_data <- cmt01a_pre(syn_data) 5 | raw_res <- cmt01a_main(pre_data) 6 | res <- cmt01a_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | test_that("cmt01a functions with custom argument value return expected result with test data", { 11 | skip_on_os("windows") 12 | pre_data <- cmt01a_pre(syn_data) 13 | raw_res <- cmt01a_main(pre_data, summary_labels = list( 14 | TOTAL = c( 15 | unique = "Total number of {patient_label} with at least one treatment", 16 | nonunique = "Total number of treatments" 17 | ), ATC2 = c(unique = "Total number of {patient_label} with at least one treatment") 18 | )) 19 | res <- cmt01a_post(raw_res, sort_by_freq = TRUE) 20 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 21 | }) 22 | 23 | # cmt01a ---- 24 | 25 | test_that("cmt01a can handle all NA values", { 26 | skip_on_os("windows") 27 | proc_data <- syn_data 28 | proc_data$adcm <- proc_data$adcm %>% 29 | mutate( 30 | ATC2 = with_label(NA_character_, var_labels_for(syn_data$adcm, "ATC2")), 31 | CMDECOD = with_label(NA_character_, var_labels_for(syn_data$adcm, "CMDECOD")) 32 | ) 33 | 34 | res <- expect_silent(run(cmt01a, proc_data)) 35 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 36 | }) 37 | 38 | test_that("cmt01a can handle some NA values", { 39 | skip_on_os("windows") 40 | proc_data <- syn_data 41 | proc_data$adcm$ATC2[1:2] <- NA 42 | proc_data$adcm$CMDECOD[1:2] <- NA 43 | res <- expect_silent(run(cmt01a, proc_data)) 44 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 45 | }) 46 | -------------------------------------------------------------------------------- /tests/testthat/test-cmt02_pt.R: -------------------------------------------------------------------------------- 1 | test_that("cmt02_pt can handle all NA values", { 2 | proc_data <- syn_data 3 | proc_data$adcm <- proc_data$adcm %>% 4 | mutate( 5 | CMDECOD = NA_character_ 6 | ) 7 | 8 | res <- expect_silent(run(cmt02_pt, proc_data)) 9 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 10 | }) 11 | 12 | test_that("cmt02_pt can handle some NA values", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | proc_data$adcm[1:2, c("CMDECOD")] <- NA 16 | 17 | res <- expect_silent(run(cmt02_pt, proc_data)) 18 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 19 | }) 20 | -------------------------------------------------------------------------------- /tests/testthat/test-coxt01.R: -------------------------------------------------------------------------------- 1 | test_that("coxt01 can handle some NA values", { 2 | proc_data <- dunlin::log_filter(syn_data, PARAMCD == "CRSD", "adtte") 3 | proc_data <- dunlin::log_filter(proc_data, ARM != "C: Combination", "adsl") 4 | proc_data$adtte[1:2, c("SEX", "RACE", "CNSR", "AVAL", "AAGE")] <- NA 5 | expect_silent(res1 <- run(coxt01, proc_data)) 6 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 7 | skip_on_os("windows") 8 | expect_silent(res2 <- run(coxt01, proc_data, conf_level = .90)) 9 | expect_snapshot(cat(export_as_txt(res2, lpp = 100))) 10 | 11 | res3 <- expect_silent(run(coxt01, proc_data, covariates = c("SEX", "AAGE"))) 12 | expect_snapshot(cat(export_as_txt(res3, lpp = 100))) 13 | 14 | res4 <- expect_silent(run(coxt01, proc_data, covariates = c("SEX", "AAGE"), strata = c("RACE"))) 15 | expect_snapshot(cat(export_as_txt(res4, lpp = 100))) 16 | }) 17 | 18 | test_that("coxt01 fails on incomlete data", { 19 | skip_on_os("windows") 20 | proc_data <- syn_data 21 | proc_data$adtte <- proc_data$adtte %>% 22 | mutate(PARAMCD = NULL) 23 | expect_error(run(coxt01, proc_data)) 24 | }) 25 | -------------------------------------------------------------------------------- /tests/testthat/test-coxt02.R: -------------------------------------------------------------------------------- 1 | test_that("coxt02 can handle some NA values", { 2 | proc_data <- dunlin::log_filter(syn_data, PARAMCD == "CRSD", "adtte") 3 | proc_data$adtte[1:4, c("SEX", "RACE", "CNSR", "AVAL", "AAGE")] <- NA 4 | res1 <- expect_silent(run(coxt02, proc_data)) 5 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 6 | skip_on_os("windows") 7 | res2 <- expect_silent(run(coxt02, proc_data, conf_level = .90)) 8 | expect_snapshot(cat(export_as_txt(res2, lpp = 100))) 9 | 10 | res3 <- expect_silent(run(coxt02, proc_data, covariates = c("SEX", "AAGE"))) 11 | expect_snapshot(cat(export_as_txt(res3, lpp = 100))) 12 | 13 | res4 <- expect_silent(run(coxt02, proc_data, covariates = c("SEX", "AAGE"), strata = c("RACE"))) 14 | expect_snapshot(cat(export_as_txt(res4, lpp = 100))) 15 | }) 16 | 17 | test_that("coxt02 fails on incomlete data", { 18 | skip_on_os("windows") 19 | proc_data <- syn_data 20 | proc_data$adtte <- proc_data$adtte %>% 21 | mutate(PARAMCD = NULL) 22 | expect_error(run(coxt02, proc_data)) 23 | }) 24 | -------------------------------------------------------------------------------- /tests/testthat/test-dst01.R: -------------------------------------------------------------------------------- 1 | # NA values ---- 2 | 3 | test_that("dst01 works as expected when all data are NA", { 4 | proc_data <- syn_data 5 | proc_data$adsl <- proc_data$adsl %>% 6 | mutate( 7 | EOSSTT = NA_character_, 8 | DCSREAS = NA_character_ 9 | ) 10 | expect_silent(res <- run(dst01, proc_data, detail_vars = list())) 11 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 12 | }) 13 | 14 | test_that("dst01 can handle all NA values in DCSREAS", { 15 | skip_on_os("windows") 16 | proc_data <- syn_data 17 | proc_data$adsl <- proc_data$adsl %>% 18 | mutate( 19 | DCSREAS = factor(NA_character_) 20 | ) 21 | 22 | res <- expect_silent(run(dst01, proc_data, detail_vars = list())) 23 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 24 | }) 25 | 26 | test_that("dst01 can handle some NA values", { 27 | skip_on_os("windows") 28 | proc_data <- syn_data 29 | proc_data$adsl[1:2, c("EOSSTT", "DCSREAS")] <- NA 30 | res <- expect_silent(run(dst01, proc_data)) 31 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 32 | }) 33 | 34 | test_that("dst01 can handle missing levels in status_var", { 35 | skip_on_os("windows") 36 | proc_data <- syn_data 37 | proc_data$adsl <- proc_data$adsl %>% 38 | mutate( 39 | EOSSTT = with_label(factor(.data$EOSSTT, levels = "ONGOING"), var_labels_for(syn_data$adsl, "EOSSTT")), 40 | ) 41 | res <- expect_silent(run(dst01, proc_data, detail_vars = list())) 42 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 43 | }) 44 | 45 | test_that("dst01 can create variants", { 46 | skip_on_os("windows") 47 | res <- expect_silent(run(dst01, syn_data, detail_vars = list(Ongoing = "STDONS", Discontinued = "DCSREAS"))) 48 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 49 | }) 50 | 51 | test_that("dst01 can create variants", { 52 | skip_on_os("windows") 53 | res <- expect_silent(run(dst01, syn_data, detail_vars = list(Discontinued = c("DCSREASGP", "DCSREAS")))) 54 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 55 | }) 56 | 57 | test_that("dst01 can create variants", { 58 | skip_on_os("windows") 59 | res <- expect_silent( 60 | run(dst01, syn_data, detail_vars = list(Discontinued = c("DCSREASGP", "DCSREAS")), trt_status_var = "EOTSTT") 61 | ) 62 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 63 | }) 64 | -------------------------------------------------------------------------------- /tests/testthat/test-dtht01.R: -------------------------------------------------------------------------------- 1 | # NA values ---- 2 | 3 | test_that("dtht01 can handle all NA values", { 4 | proc_data <- syn_data 5 | proc_data$adsl <- proc_data$adsl %>% 6 | mutate( 7 | DTHCAT = NA_character_, 8 | DTHCAUS = NA_character_ 9 | ) 10 | 11 | res <- expect_silent(run(dtht01, proc_data, time_since_last_dose = FALSE, other_category = FALSE, prune_0 = FALSE)) 12 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 13 | }) 14 | 15 | test_that("dtht01 can handle some NA values", { 16 | skip_on_os("windows") 17 | proc_data <- syn_data 18 | proc_data$adsl[1:2, c("DTHCAT", "DTHCAUS")] <- NA 19 | res <- expect_silent(run(dtht01, proc_data, time_since_last_dose = TRUE, other_category = TRUE)) 20 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 21 | }) 22 | 23 | # Arguments ---- 24 | 25 | test_that("dtht01 can be parametrize as expected", { 26 | skip_on_os("windows") 27 | proc_data <- syn_data 28 | 29 | pre_data <- dtht01_pre(proc_data) 30 | raw_res <- dtht01_main(pre_data, time_since_last_dose = TRUE, other_category = TRUE) 31 | res <- dtht01_post(raw_res) 32 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 33 | }) 34 | -------------------------------------------------------------------------------- /tests/testthat/test-egt01.R: -------------------------------------------------------------------------------- 1 | # egt01 functions ---- 2 | 3 | test_that("egt01 functions with default argument value return expected result with test data", { 4 | pre_data <- egt01_pre(syn_data) 5 | raw_res <- egt01_main(pre_data) 6 | res <- cfbt01_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | # egt01 ---- 11 | 12 | test_that("egt01 can handle n = 0 and outputs NE instead of infs and NAs", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | proc_data$adeg <- proc_data$adeg %>% 16 | filter(PARAM != "HR" & ACTARM != "A: Drug X") 17 | 18 | res <- expect_silent( 19 | run(egt01, proc_data, precision = list("HR" = 1, default = 0)) 20 | ) 21 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 22 | }) 23 | -------------------------------------------------------------------------------- /tests/testthat/test-egt02.R: -------------------------------------------------------------------------------- 1 | # egt02 functions ---- 2 | 3 | test_that("egt02_1 functions with default argument value return expected result with test data", { 4 | pre_data <- egt02_pre(syn_data) 5 | raw_res <- egt02_1_main(pre_data) 6 | res <- egt02_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | test_that("egt02_2 functions with default value return expected result with test data", { 11 | skip_on_os("windows") 12 | pre_data <- egt02_pre(syn_data) 13 | raw_res <- egt02_2_main(pre_data) 14 | res <- egt02_post(raw_res) 15 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 16 | }) 17 | -------------------------------------------------------------------------------- /tests/testthat/test-egt03.R: -------------------------------------------------------------------------------- 1 | # egt03 functions ---- 2 | 3 | test_that("egt03 functions with default argument value return expected result with test data", { 4 | pre_data <- egt03_pre(syn_data) 5 | raw_res <- egt03_main(pre_data) 6 | res <- egt03_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | # egt03 ---- 11 | 12 | test_that("egt03 errors on all NA values", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | proc_data$adeg <- proc_data$adeg %>% 16 | mutate( 17 | BNRIND = NA_character_, 18 | ANRIND = NA_character_, 19 | ) 20 | 21 | expect_error(run(egt03, proc_data)) 22 | }) 23 | 24 | test_that("egt03 can handle some NA values", { 25 | skip_on_os("windows") 26 | proc_data <- syn_data 27 | proc_data$adeg[1:2, c("ANRIND", "BNRIND")] <- NA 28 | 29 | res <- expect_silent(run(egt03, proc_data)) 30 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 31 | }) 32 | 33 | test_that("egt03 fails on incomplete data", { 34 | skip_on_os("windows") 35 | proc_data <- syn_data 36 | proc_data$adeg <- proc_data$adeg %>% 37 | mutate(PARAMCD = NULL) 38 | 39 | expect_error( 40 | run(egt03, proc_data) 41 | ) 42 | }) 43 | -------------------------------------------------------------------------------- /tests/testthat/test-egt05_qtcat.R: -------------------------------------------------------------------------------- 1 | # egt05_qtcat functions ---- 2 | 3 | test_that("egt05_qtcat functions with default argument value return expected result with test data", { 4 | pre_data <- egt05_qtcat_pre(syn_data) 5 | raw_res <- egt05_qtcat_main(pre_data) 6 | res <- egt05_qtcat_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | # egt05_qtcat ---- 11 | 12 | test_that("egt05_qtcat erros on all NA values", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | proc_data$adeg <- proc_data$adeg %>% 16 | mutate( 17 | AVISIT = NA_character_, 18 | ) 19 | 20 | expect_error(run(egt05_qtcat, proc_data)) 21 | }) 22 | 23 | test_that("egt05_qtcat can handle some NA values", { 24 | skip_on_os("windows") 25 | proc_data <- syn_data 26 | proc_data$adeg <- proc_data$adeg %>% 27 | filter(PARAMCD == "QT") 28 | proc_data$adeg[1:2, c("AVALCAT1", "CHGCAT1")] <- NA 29 | res <- expect_silent(run(egt05_qtcat, proc_data)) 30 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 31 | }) 32 | -------------------------------------------------------------------------------- /tests/testthat/test-fstg01.R: -------------------------------------------------------------------------------- 1 | # fstg01 functions ---- 2 | 3 | test_that("fstg01 works as expected", { 4 | proc_data <- dunlin::log_filter(syn_data, PARAMCD == "BESRSPI" & ARM %in% c("A: Drug X", "B: Placebo"), "adrs") 5 | pre_data <- expect_silent(fstg01_pre(proc_data, dataset = "adrs", response = c("CR", "PR"))) 6 | raw_res <- expect_silent(fstg01_main(pre_data, dataset = "adrs")) 7 | expect_true(ggplot2::is_ggplot(raw_res)) 8 | }) 9 | 10 | # fstg01 ---- 11 | 12 | test_that("fstg01 works as expected with custom color set", { 13 | skip_on_os("windows") 14 | proc_data <- dunlin::log_filter(syn_data, PARAMCD == "BESRSPI" & ARM %in% c("A: Drug X", "B: Placebo"), "adrs") 15 | 16 | res1 <- expect_silent(run(fstg01, proc_data, response = c("CR", "PR"), dataset = "adrs", col = "gray")) 17 | expect_true(ggplot2::is_ggplot(res1)) 18 | 19 | res2 <- expect_silent(run(fstg01, proc_data, response = c("CR", "PR"), dataset = "adrs", col_symbol_size = NULL)) 20 | expect_true(ggplot2::is_ggplot(res2)) 21 | }) 22 | 23 | test_that("fstg01 works if changes are in subgroups, conf_level, and label_all", { 24 | skip_on_os("windows") 25 | proc_data <- dunlin::log_filter(syn_data, PARAMCD == "BESRSPI" & ARM %in% c("A: Drug X", "B: Placebo"), "adrs") 26 | 27 | res1 <- expect_silent(run(fstg01, proc_data, response = c("CR", "PR"), subgroups = NULL, dataset = "adrs")) 28 | expect_true(ggplot2::is_ggplot(res1)) 29 | 30 | res2 <- expect_silent(run(fstg01, proc_data, 31 | response = c("CR", "PR"), subgroups = c("SEX"), 32 | conf_level = 0.9, label_all = "All Patients", dataset = "adrs" 33 | )) 34 | expect_true(ggplot2::is_ggplot(res2)) 35 | }) 36 | 37 | test_that("fstg01 can handle some NA values in subgroups", { 38 | skip_on_os("windows") 39 | proc_data <- dunlin::log_filter(syn_data, PARAMCD == "BESRSPI" & ARM %in% c("A: Drug X", "B: Placebo"), "adrs") 40 | proc_data$adrs[1:2, "SEX"] <- NA 41 | proc_data$adrs[3:4, "AGEGR1"] <- NA 42 | proc_data$adrs[5:6, "RACE"] <- NA 43 | 44 | res <- expect_silent(run(fstg01, proc_data, response = c("CR", "PR"), dataset = "adrs")) 45 | expect_true(ggplot2::is_ggplot(res)) 46 | }) 47 | -------------------------------------------------------------------------------- /tests/testthat/test-lbt01.R: -------------------------------------------------------------------------------- 1 | # lbt01 functions ---- 2 | 3 | test_that("lbt01 functions with default argument value return expected result with test data", { 4 | proc_data <- syn_data[c("adsl", "adlb")] 5 | proc_data$adlb <- proc_data$adlb %>% 6 | dplyr::mutate(PARAMCD = paste0(PARAMCD, "SI")) 7 | 8 | pre_data <- lbt01_pre(proc_data) 9 | raw_res <- lbt01_main(pre_data) 10 | res <- cfbt01_post(raw_res) 11 | expect_snapshot(cat(export_as_txt(res, lpp = 200))) 12 | }) 13 | 14 | # lbt01 functions ---- 15 | 16 | test_that("lbt01 functions with row_split_var return expected result with test data", { 17 | skip_on_os("windows") 18 | pre_data <- lbt01_pre(syn_data) 19 | raw_res <- lbt01_main(pre_data, row_split_var = "LBCAT", precision = list("ALT" = 0)) 20 | res <- cfbt01_post(raw_res) 21 | expect_snapshot(cat(export_as_txt(res, lpp = 200))) 22 | }) 23 | 24 | # lbt01 ---- 25 | 26 | test_that("lbt01 can handle n = 0 and outputs NE instead of infs and NAs", { 27 | skip_on_os("windows") 28 | proc_data <- syn_data 29 | proc_data$adlb <- proc_data$adlb %>% 30 | filter(PARAM != "ALT" & ACTARM != "A: Drug X") 31 | 32 | res <- expect_silent( 33 | run(lbt01, proc_data, precision = list("ALT" = 0, "CRP" = 1)) 34 | ) 35 | expect_snapshot(cat(export_as_txt(res, lpp = 200))) 36 | }) 37 | -------------------------------------------------------------------------------- /tests/testthat/test-lbt04.R: -------------------------------------------------------------------------------- 1 | # lbt04 functions ---- 2 | 3 | test_that("lbt04 functions with default argument value return expected result with test data", { 4 | pre_data <- lbt04_pre(syn_data) 5 | raw_res <- lbt04_main(pre_data) 6 | res <- lbt04_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | # lbt04 ---- 11 | 12 | test_that("lbt04 can handle all NA values", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | proc_data$adlb <- proc_data$adlb %>% 16 | mutate( 17 | ANRIND = NA_character_ 18 | ) 19 | 20 | res <- expect_silent(run(lbt04, proc_data)) 21 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 22 | }) 23 | 24 | test_that("lbt04 can handle missing levels", { 25 | skip_on_os("windows") 26 | proc_data <- syn_data 27 | proc_data$adlb <- proc_data$adlb %>% 28 | mutate( 29 | ANRIND = "" 30 | ) 31 | 32 | res <- expect_silent(run(lbt04, proc_data)) 33 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 34 | }) 35 | 36 | test_that("lbt04 can handle some NA values", { 37 | skip_on_os("windows") 38 | proc_data <- syn_data 39 | proc_data$adlb[1:2, "ANRIND"] <- NA 40 | 41 | res <- expect_silent(run(lbt04, proc_data)) 42 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 43 | }) 44 | 45 | test_that("lbt04 fails on incomlete data", { 46 | skip_on_os("windows") 47 | proc_data <- syn_data 48 | proc_data$adlb <- proc_data$adlb %>% 49 | mutate(PARCAT1 = NULL) 50 | 51 | expect_error(run(lbt04, proc_data)) 52 | }) 53 | -------------------------------------------------------------------------------- /tests/testthat/test-lbt06.R: -------------------------------------------------------------------------------- 1 | test_that("lbt06 gives all 0 count if ANRIND and BNRIND are all missing", { 2 | proc_data <- syn_data 3 | proc_data$adlb <- proc_data$adlb %>% 4 | mutate( 5 | ANRIND = NA_character_, 6 | BNRIND = NA_character_ 7 | ) 8 | df_pre <- lbt06_pre(proc_data) 9 | tlg <- lbt06_main(df_pre) 10 | res <- smart_prune(tlg) 11 | expect_identical(nrow(res), 0L) 12 | }) 13 | 14 | test_that("lbt06 can handle some NA values", { 15 | skip_on_os("windows") 16 | proc_data <- syn_data 17 | proc_data$adlb[1:4, c("ANRIND", "BNRIND")] <- NA 18 | df_pre <- lbt06_pre(proc_data) 19 | tlg <- lbt06_main(df_pre) 20 | res <- lbt06_post(tlg, prune_0 = TRUE) 21 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 22 | }) 23 | 24 | test_that("lbt06 fails on incomplete data", { 25 | skip_on_os("windows") 26 | proc_data <- syn_data 27 | proc_data$adlb <- proc_data$adlb %>% 28 | mutate(PARCAT2 = NULL) 29 | expect_error(lbt06_pre(proc_data)) 30 | }) 31 | -------------------------------------------------------------------------------- /tests/testthat/test-lbt07.R: -------------------------------------------------------------------------------- 1 | # lbt07 functions ---- 2 | 3 | test_that("lbt07 functions with default argument value return expected result with test data", { 4 | pre_data <- lbt07_pre(syn_data) 5 | raw_res <- lbt07_main(pre_data) 6 | res <- lbt07_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | # lbt07 ---- 11 | 12 | test_that("lbt07 can handle some NA values", { 13 | skip_on_os("windows") 14 | new_grade_dir <- c(NA_character_, "", as.character(syn_data$adlb$ATOXGR[-c(1, 2)])) 15 | 16 | proc_data <- syn_data 17 | proc_data$adlb <- proc_data$adlb %>% 18 | mutate( 19 | GRADE_DIR = factor(.env$new_grade_dir), 20 | ) 21 | 22 | res <- expect_silent(run(lbt07, proc_data)) 23 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 24 | }) 25 | 26 | test_that("lbt07 fails on incomlete data", { 27 | skip_on_os("windows") 28 | proc_data <- syn_data 29 | proc_data$adlb <- proc_data$adlb %>% 30 | mutate(ATOXGR = NULL) 31 | 32 | expect_error(run(lbt07, proc_data)) 33 | }) 34 | -------------------------------------------------------------------------------- /tests/testthat/test-lbt15.R: -------------------------------------------------------------------------------- 1 | # lbt15 functions ---- 2 | 3 | test_that("lbt15 functions with default argument value return expected result with test data", { 4 | pre_data <- lbt15_pre(syn_data) 5 | raw_res <- lbt04_main(pre_data) 6 | res <- lbt04_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | # lbt15 ---- 11 | 12 | test_that("lbt15 can handle all NA values", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | proc_data$adlb <- proc_data$adlb %>% 16 | mutate( 17 | ATOXGR = NA_character_ 18 | ) 19 | 20 | res <- expect_silent(run(lbt15, proc_data)) 21 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 22 | }) 23 | 24 | test_that("lbt15 can handle missing levels", { 25 | skip_on_os("windows") 26 | proc_data <- syn_data 27 | proc_data$adlb <- proc_data$adlb %>% 28 | mutate( 29 | ATOXGR = "" 30 | ) 31 | 32 | res <- expect_silent(run(lbt15, proc_data)) 33 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 34 | }) 35 | 36 | test_that("lbt15 can handle missing levels in baseline", { 37 | skip_on_os("windows") 38 | proc_data <- syn_data 39 | proc_data$adlb <- proc_data$adlb %>% 40 | mutate( 41 | BTOXGR = "" 42 | ) 43 | 44 | res <- expect_silent(run(lbt15, proc_data)) 45 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 46 | }) 47 | 48 | test_that("lbt15 can handle some NA values", { 49 | skip_on_os("windows") 50 | proc_data <- syn_data 51 | proc_data$adlb[1:2, "ATOXGR"] <- NA 52 | 53 | res <- expect_silent(run(lbt15, proc_data)) 54 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 55 | }) 56 | 57 | test_that("lbt15 can handle some NA values in baseline", { 58 | skip_on_os("windows") 59 | proc_data <- syn_data 60 | proc_data$adlb[1:2, "BTOXGR"] <- NA 61 | 62 | res <- expect_silent(run(lbt15, proc_data)) 63 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 64 | }) 65 | 66 | test_that("lbt15 fails on incomlete data", { 67 | skip_on_os("windows") 68 | proc_data <- syn_data 69 | proc_data$adlb <- proc_data$adlb %>% 70 | mutate(PARCAT1 = NULL) 71 | 72 | expect_error(run(lbt15, proc_data)) 73 | }) 74 | -------------------------------------------------------------------------------- /tests/testthat/test-mht01.R: -------------------------------------------------------------------------------- 1 | # mht01 functions ---- 2 | 3 | test_that("mht01 functions with default argument value return expected result with test data", { 4 | pre_data <- mht01_pre(syn_data) 5 | raw_res <- mht01_main(pre_data) 6 | res <- mht01_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | # mht01 ---- 11 | 12 | test_that("mht01 works", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | res <- run(mht01, proc_data) 16 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 17 | }) 18 | 19 | test_that("mht01 works on NULL in lbl_mhbodsys or lbl_mhdecod", { 20 | skip_on_os("windows") 21 | proc_data <- syn_data 22 | res <- run(mht01, proc_data, lbl_mhbodsys = NULL, lbl_mhdecod = NULL) 23 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 24 | }) 25 | 26 | test_that("mht01 works with other row_split_var", { 27 | skip_on_os("windows") 28 | proc_data <- syn_data 29 | res <- run(mht01, proc_data, row_split_var = c("SEX", "ETHNIC")) 30 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 31 | }) 32 | -------------------------------------------------------------------------------- /tests/testthat/test-pdt01.R: -------------------------------------------------------------------------------- 1 | # pdt01 functions ---- 2 | 3 | test_that("pdt01 function with default argument value return expected result with test data", { 4 | pre_data <- pdt01_pre(syn_data) 5 | raw_res <- pdt01_main(pre_data) 6 | res <- pdt01_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 200))) 8 | }) 9 | 10 | # pdt01 ---- 11 | 12 | test_that("pdt01 can handle all NA values", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | proc_data$addv <- proc_data$addv %>% 16 | mutate( 17 | DVDECOD = NA_character_, 18 | DVTERM = NA_character_, 19 | ) 20 | 21 | res <- expect_silent(run(pdt01, proc_data)) 22 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 200))) 23 | }) 24 | 25 | test_that("pdt01 can handle some NA values", { 26 | skip_on_os("windows") 27 | new_dvdecod <- c(NA_character_, "", as.character(syn_data$addv$DVDECOD[-c(1, 2)])) 28 | new_dvterm <- c(NA_character_, "", as.character(syn_data$addv$DVTERM[-c(1, 2)])) 29 | 30 | proc_data <- syn_data 31 | proc_data$addv <- proc_data$addv %>% 32 | mutate( 33 | DVDECOD = .env$new_dvdecod, 34 | DVTERM = .env$new_dvterm 35 | ) 36 | 37 | res <- expect_silent(run(pdt01, proc_data)) 38 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 200))) 39 | }) 40 | -------------------------------------------------------------------------------- /tests/testthat/test-pdt02.R: -------------------------------------------------------------------------------- 1 | # pdt02 function ---- 2 | 3 | test_that("pdt02 function with default argument value return expected result with test data", { 4 | pre_data <- pdt02_pre(syn_data) 5 | raw_res <- pdt02_main(pre_data) 6 | res <- pdt02_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100, colwidths = c(40, 10, 10, 10)))) 8 | }) 9 | 10 | # pdt02 ---- 11 | 12 | test_that("pdt02 can handle all NA values", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | proc_data$addv <- proc_data$addv %>% 16 | mutate( 17 | DVREAS = NA_character_, 18 | DVTERM = NA_character_, 19 | ) 20 | 21 | res <- expect_silent(run(pdt02, proc_data)) 22 | expect_snapshot(cat(export_as_txt(res, lpp = 100, colwidths = c(40, 10, 10, 10)))) 23 | }) 24 | 25 | test_that("pdt02 can handle some NA values", { 26 | skip_on_os("windows") 27 | new_dvreas <- c(NA_character_, "", as.character(syn_data$addv$DVREAS[-c(1, 2)])) 28 | new_dvterm <- c(NA_character_, "", as.character(syn_data$addv$DVTERM[-c(1, 2)])) 29 | 30 | proc_data <- syn_data 31 | proc_data$addv <- proc_data$addv %>% 32 | mutate( 33 | DVREAS = new_dvreas, 34 | DVTERM = new_dvterm 35 | ) 36 | 37 | res <- expect_silent(run(pdt02, proc_data)) 38 | expect_snapshot(cat(export_as_txt(res, lpp = 100, colwidths = c(40, 10, 10, 10)))) 39 | }) 40 | -------------------------------------------------------------------------------- /tests/testthat/test-reexports.R: -------------------------------------------------------------------------------- 1 | # with_label ---- 2 | 3 | test_that("with_label exported correctly", { 4 | expect_identical( 5 | chevron::with_label, 6 | formatters::with_label 7 | ) 8 | }) 9 | 10 | # reformat ---- 11 | 12 | test_that("reformat exported correctly", { 13 | expect_identical( 14 | chevron::reformat, 15 | dunlin::reformat 16 | ) 17 | }) 18 | -------------------------------------------------------------------------------- /tests/testthat/test-report_null.R: -------------------------------------------------------------------------------- 1 | # report_null ---- 2 | 3 | test_that("report_null works as expected with `NULL`", { 4 | expect_silent(res <- report_null(NULL)) 5 | expect_identical(res, standard_null_report()) 6 | }) 7 | 8 | test_that("report_null works as expected with `VTableTree`", { 9 | lyt <- basic_table() %>% analyze("Species") 10 | tab <- build_table(lyt, iris) 11 | rtables::table_inset(tab) <- 2L 12 | expect_identical(tab, report_null(tab)) 13 | 14 | tab <- build_table(basic_table(), data.frame()) 15 | expect_silent(res <- report_null(tab)) 16 | expect_identical(res, standard_null_report()) 17 | }) 18 | 19 | test_that("report_null works as expected with `listing_df`", { 20 | lst <- rlistings::as_listing(iris, "Species", "Sepal.Length") 21 | expect_identical(lst, report_null(lst)) 22 | 23 | lst <- rlistings::as_listing(iris[NULL, ], "Species", "Sepal.Length") 24 | expect_silent(lst <- report_null(lst)) 25 | expect_identical(lst, standard_null_report()) 26 | }) 27 | 28 | test_that("report_null works as expected with `list`", { 29 | lst <- rlistings::as_listing(iris, "Species", "Sepal.Length", split_into_pages_by_var = "Species") 30 | expect_identical(lst, report_null(lst)) 31 | 32 | lst <- rlistings::as_listing(iris[NULL, ], "Species", "Sepal.Length", split_into_pages_by_var = "Species") 33 | lst <- report_null(lst) 34 | expect_identical(lst, standard_null_report()) 35 | }) 36 | 37 | test_that("report_null works as expected with by default", { 38 | expect_silent(int <- report_null(1L)) 39 | expect_identical(int, 1L) 40 | }) 41 | -------------------------------------------------------------------------------- /tests/testthat/test-rmpt01.R: -------------------------------------------------------------------------------- 1 | # rmpt01 functions ---- 2 | 3 | test_that("rmpt01 function with default argument value return expected result with test data", { 4 | pre_data <- rmpt01_pre(syn_data) 5 | raw_res <- rmpt01_main(pre_data) 6 | res <- rmpt01_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | # rmpt01 ---- 11 | 12 | test_that("rmpt01 can handle NA values", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | proc_data$adex$AVAL <- NA_real_ 16 | 17 | res1 <- expect_silent(run(rmpt01, proc_data)) 18 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 19 | 20 | res2 <- expect_silent(run(rmpt01, proc_data, row_split_var = "PARCAT2")) 21 | expect_snapshot(cat(export_as_txt(res2, lpp = 100))) 22 | }) 23 | 24 | test_that("rmpt01 can handle some NA values", { 25 | skip_on_os("windows") 26 | proc_data <- syn_data 27 | proc_data$adex <- proc_data$adex %>% 28 | mutate( 29 | AVAL = case_when(PARAMCD == "TDURD" & AVAL %% 2 == 0 ~ NA, TRUE ~ .data$AVAL) 30 | ) 31 | 32 | res1 <- expect_silent(run(rmpt01, proc_data)) 33 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 34 | 35 | res2 <- expect_silent(run(rmpt01, proc_data, row_split_var = "PARCAT2")) 36 | expect_snapshot(cat(export_as_txt(res2, lpp = 100))) 37 | }) 38 | 39 | test_that("rmpt01 fails on incomlete data", { 40 | skip_on_os("windows") 41 | proc_data <- syn_data 42 | proc_data$adex <- proc_data$adex %>% 43 | mutate( 44 | PARAMCD = NULL 45 | ) 46 | 47 | expect_error(run(rmpt01, proc_data)) 48 | expect_error(run(rmpt01, proc_data, row_split_var = "PARCAT2")) 49 | }) 50 | -------------------------------------------------------------------------------- /tests/testthat/test-rmpt04.R: -------------------------------------------------------------------------------- 1 | # rmpt04 functions ---- 2 | 3 | test_that("rmpt04 function with default argument value return expected result with test data", { 4 | pre_data <- rmpt04_pre(syn_data) 5 | raw_res <- rmpt04_main(pre_data) 6 | res <- rmpt01_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | # rmpt04 ---- 11 | 12 | test_that("rmpt04 can handle NA values", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | proc_data$adex$AVAL <- NA_real_ 16 | 17 | res1 <- expect_silent(run(rmpt04, proc_data)) 18 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 19 | 20 | res2 <- expect_silent(run(rmpt04, proc_data, prune_0 = FALSE)) 21 | expect_snapshot(cat(export_as_txt(res2, lpp = 100))) 22 | }) 23 | 24 | test_that("rmpt04 can handle some NA values", { 25 | skip_on_os("windows") 26 | proc_data <- syn_data 27 | proc_data$adex <- proc_data$adex %>% 28 | mutate( 29 | AVAL = case_when( 30 | .data$ETHNIC == "HISPANIC OR LATINO" & .data$PARAMCD == "TDURD" ~ NA, 31 | .default = .data$AVAL 32 | ) 33 | ) 34 | 35 | res1 <- expect_silent(run(rmpt04, proc_data)) 36 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 37 | 38 | proc_data <- syn_data 39 | proc_data$adex$ETHNIC <- as.character(proc_data$adex$ETHNIC) 40 | proc_data$adex$ETHNIC[1:2] <- c(NA_character_, "") 41 | 42 | res2 <- expect_silent(run(rmpt04, proc_data)) 43 | expect_snapshot(cat(export_as_txt(res2, lpp = 100))) 44 | }) 45 | 46 | test_that("rmpt04 fails on incomlete data", { 47 | skip_on_os("windows") 48 | proc_data <- syn_data 49 | proc_data$adex <- proc_data$adex %>% 50 | mutate( 51 | ETHNIC = NULL 52 | ) 53 | 54 | expect_error( 55 | expect_warning(run(rmpt04, proc_data)) 56 | ) 57 | }) 58 | -------------------------------------------------------------------------------- /tests/testthat/test-rmpt05.R: -------------------------------------------------------------------------------- 1 | # rmpt05 functions ---- 2 | 3 | test_that("rmpt05 function with default argument value return expected result with test data", { 4 | pre_data <- rmpt05_pre(syn_data) 5 | raw_res <- rmpt05_main(pre_data) 6 | res <- rmpt01_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | # rmpt05 ---- 11 | 12 | test_that("rmpt05 can handle NA values", { 13 | skip_on_os("windows") 14 | proc_data <- syn_data 15 | proc_data$adex$AVAL <- NA_real_ 16 | 17 | res1 <- expect_silent(run(rmpt05, proc_data)) 18 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 19 | 20 | res2 <- expect_silent(run(rmpt05, proc_data, prune_0 = FALSE)) 21 | expect_snapshot(cat(export_as_txt(res2, lpp = 100))) 22 | }) 23 | 24 | test_that("rmpt05 can handle some NA values", { 25 | skip_on_os("windows") 26 | proc_data <- syn_data 27 | proc_data$adex <- proc_data$adex %>% 28 | mutate( 29 | AVAL = case_when( 30 | .data$RACE == "HISPANIC OR LATINO" & .data$PARAMCD == "TDURD" ~ NA, 31 | .default = .data$AVAL 32 | ) 33 | ) 34 | 35 | res1 <- expect_silent(run(rmpt05, proc_data)) 36 | expect_snapshot(cat(export_as_txt(res1, lpp = 100))) 37 | 38 | proc_data <- syn_data 39 | proc_data$adex$RACE <- as.character(proc_data$adex$RACE) 40 | proc_data$adex$RACE[1:2] <- c(NA_character_, "") 41 | 42 | res2 <- expect_silent(run(rmpt05, proc_data)) 43 | expect_snapshot(cat(export_as_txt(res2, lpp = 100))) 44 | }) 45 | 46 | test_that("rmpt05 fails on incomlete data", { 47 | skip_on_os("windows") 48 | proc_data <- syn_data 49 | proc_data$adex <- proc_data$adex %>% 50 | mutate( 51 | RACE = NULL 52 | ) 53 | 54 | expect_error( 55 | expect_warning(run(rmpt05, proc_data)) 56 | ) 57 | }) 58 | -------------------------------------------------------------------------------- /tests/testthat/test-rmpt06.R: -------------------------------------------------------------------------------- 1 | # rmpt06 ---- 2 | 3 | test_that("rmpt06 works as expected", { 4 | res <- rmpt06_pre(syn_data) %>% 5 | rmpt06_main() %>% 6 | rmpt01_post() 7 | 8 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 200))) 9 | }) 10 | 11 | test_that("rmpt06 works as expected with show_diff = TRUE", { 12 | skip_on_os("windows") 13 | res <- rmpt06_pre(syn_data) %>% 14 | rmpt06_main(show_diff = TRUE) %>% 15 | rmpt01_post() 16 | 17 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 200))) 18 | }) 19 | 20 | test_that("rmpt06 can handle all NA values", { 21 | skip_on_os("windows") 22 | proc_data <- syn_data 23 | proc_data$adae <- proc_data$adae %>% 24 | mutate( 25 | ATOXGR = factor(NA, levels = 1:5), 26 | AEOUT = factor(NA), 27 | AESER = NA 28 | ) 29 | 30 | res <- expect_silent(run(rmpt06, proc_data)) 31 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 200))) 32 | res <- expect_silent(run(rmpt06, proc_data, prune_0 = TRUE)) 33 | expect_snapshot(cat(export_as_txt(res, lpp = 100, cpp = 200))) 34 | }) 35 | -------------------------------------------------------------------------------- /tests/testthat/test-vst01.R: -------------------------------------------------------------------------------- 1 | # vst12 functions ---- 2 | 3 | test_that("vst01 functions with default argument value return expected result with test data", { 4 | proc_data <- dunlin::log_filter( 5 | syn_data, 6 | PARAMCD %in% c("DIABP", "SYSBP"), "advs" 7 | ) 8 | pre_data <- vst01_pre(proc_data) 9 | raw_res <- vst01_main(pre_data) 10 | res <- cfbt01_post(raw_res) 11 | expect_snapshot(cat(export_as_txt(res, lpp = 200))) 12 | }) 13 | 14 | # vst01 ---- 15 | 16 | test_that("run vst01 works as expected", { 17 | skip_on_os("windows") 18 | proc_data <- dunlin::log_filter( 19 | syn_data, 20 | PARAMCD %in% c("DIABP", "SYSBP"), "advs" 21 | ) 22 | res <- expect_silent(run(vst01, proc_data, precision = list(default = 0))) 23 | expect_snapshot(cat(export_as_txt(res, lpp = 200))) 24 | }) 25 | -------------------------------------------------------------------------------- /tests/testthat/test-vst02.R: -------------------------------------------------------------------------------- 1 | # vst02 functions ---- 2 | 3 | test_that("vst02 functions with default argument value return expected result with test data", { 4 | pre_data <- vst02_pre(syn_data) 5 | raw_res <- vst02_1_main(pre_data) 6 | res <- vst02_post(raw_res) 7 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 8 | }) 9 | 10 | test_that("vst02 functions return expected result with test data when excluding subject with baseline abnormality", { 11 | skip_on_os("windows") 12 | pre_data <- vst02_pre(syn_data) 13 | raw_res <- vst02_2_main(pre_data) 14 | res <- vst02_post(raw_res) 15 | expect_snapshot(cat(export_as_txt(res, lpp = 100))) 16 | }) 17 | -------------------------------------------------------------------------------- /vignettes/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | *.R 3 | -------------------------------------------------------------------------------- /vignettes/script_generator.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Script_Generator" 3 | output: rmarkdown::html_vignette 4 | vignette: > 5 | %\VignetteIndexEntry{Script_Generator} 6 | %\VignetteEncoding{UTF-8} 7 | %\VignetteEngine{knitr::rmarkdown} 8 | editor_options: 9 | chunk_output_type: console 10 | --- 11 | 12 | ```{r, include = FALSE} 13 | knitr::opts_chunk$set( 14 | collapse = TRUE, 15 | comment = "#>" 16 | ) 17 | 18 | library(chevron) 19 | library(dplyr) 20 | ``` 21 | 22 | ## Introduction 23 | 24 | In addition of the embedded `run()` method to create a `tlg`, chevron offers a script-based approach that allows the 25 | user to quickly edit a chevron workflow without the need for modifying a `chevron_tlg` object. 26 | The script is generated from `script_funs` method which by default only output the script corresponding to the 27 | preprocessing function in the generated script. 28 | 29 | ## Using a chevron-defined object 30 | 31 | The object returned by the `script` methods are vectors of character with one element per line of the script, that can be easily rendered. 32 | 33 | ```{r} 34 | res <- script_funs(aet01, adam_db = "syn_data", args = "args_list") 35 | writeLines(res) 36 | ``` 37 | 38 | ## With a modified chevron object 39 | 40 | The script generator depends on the functions actually stored in the object. Modifying the `chevron_tlg` object can lead to a different script. 41 | 42 | ```{r} 43 | aet01_custom <- aet01 44 | preprocess(aet01_custom) <- function(adam_db, new_format, ...) { 45 | reformat(adam_db, new_format) 46 | } 47 | 48 | res_funs <- script_funs(aet01_custom, adam_db = "syn_data", args = "args_list") 49 | ``` 50 | 51 | Print the generated scripts. Note that a new argument `new_format` has been added and the pre processing function has been modified. 52 | 53 | ```{r} 54 | writeLines(res_funs) 55 | ``` 56 | --------------------------------------------------------------------------------