Skip to content

Commit

Permalink
Add @examplesIf to internal examples where applicable (#120)
Browse files Browse the repository at this point in the history
**What changes are proposed in this pull request?**
* Added `@examplesIf` to applicable internal function examples. (#118,
@edelarua)

Closes #118 


--------------------------------------------------------------------------------

Pre-review Checklist (if item does not apply, mark is as complete)
- [x] **All** GitHub Action workflows pass with a ✅
- [x] PR branch has pulled the most recent updates from master branch:
`usethis::pr_merge_main()`
- [x] If a bug was fixed, a unit test was added.
- [x] If a new `ard_*()` function was added, it passes the ARD
structural checks from `cards::check_ard_structure()`.
- [x] Code coverage is suitable for any new functions/features
(generally, 100% coverage for new code): `devtools::test_coverage()`

Reviewer Checklist (if item does not apply, mark is as complete)

- [ ] If a bug was fixed, a unit test was added.
- [ ] Code coverage is suitable for any new functions/features:
`devtools::test_coverage()`

When the branch is ready to be merged:
- [ ] Update `NEWS.md` with the changes from this pull request under the
heading "`# cardx (development version)`". If there is an issue
associated with the pull request, reference it in parentheses at the end
update (see `NEWS.md` for examples).
- [ ] **All** GitHub Action workflows pass with a ✅
- [ ] Approve Pull Request
- [ ] Merge the PR. Please use "Squash and merge" or "Rebase and merge".
  • Loading branch information
edelarua authored Apr 15, 2024
1 parent 3a9b6ea commit 90f2c23
Show file tree
Hide file tree
Showing 18 changed files with 28 additions and 16 deletions.
2 changes: 0 additions & 2 deletions R/ard_aod_wald_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,10 @@ ard_aod_wald_test <- function(x, ...) {

#' Extract data from wald.test object
#'
#'
#' @param wald_test (`data.frame`)\cr wald test object object from `aod::wald.test()`
#'
#' @return a data frame containing the wald test results.
#' @keywords internal

.extract_wald_results <- function(wald_test) {
df <- wald_test$result$chi2[("df")]
statistic <- wald_test$result$chi2[("chi2")]
Expand Down
2 changes: 1 addition & 1 deletion R/ard_effectsize_cohens_d.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ ard_effectsize_paired_cohens_d <- function(data, by, variables, id, ...) {
#'
#' @return ARD data frame
#' @keywords internal
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"), reference_pkg = "cardx"))
#' cardx:::.format_cohens_d_results(
#' by = "ARM",
#' variable = "AGE",
Expand Down
2 changes: 1 addition & 1 deletion R/ard_effectsize_hedges_g.R
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ ard_effectsize_paired_hedges_g <- function(data, by, variables, id, ...) {
#'
#' @return ARD data frame
#' @keywords internal
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("effectsize", "parameters"), reference_pkg = "cardx"))
#' cardx:::.format_hedges_g_results(
#' by = "ARM",
#' variable = "AGE",
Expand Down
2 changes: 1 addition & 1 deletion R/ard_stats_mcnemar_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ ard_stats_mcnemar_test <- function(data, by, variables, ...) {
#'
#' @return ARD data frame
#'
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))
#' cardx:::.format_mcnemartest_results(
#' by = "ARM",
#' variable = "AGE",
Expand Down
2 changes: 1 addition & 1 deletion R/ard_stats_mood_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ard_stats_mood_test <- function(data, by, variables, ...) {
#'
#' @return ARD data frame
#' @keywords internal
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))
#' cardx:::.format_moodtest_results(
#' by = "SEX",
#' variable = "AGE",
Expand Down
2 changes: 1 addition & 1 deletion R/ard_stats_t_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ ard_stats_paired_t_test <- function(data, by, variables, id, ...) {
#'
#' @return ARD data frame
#' @keywords internal
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))
#' cardx:::.format_ttest_results(
#' by = "ARM",
#' variable = "AGE",
Expand Down
2 changes: 1 addition & 1 deletion R/ard_stats_wilcox_test.R
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ ard_stats_paired_wilcox_test <- function(data, by, variables, id, ...) {
#'
#' @return ARD data frame
#'
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom", reference_pkg = "cardx"))
#' # Pre-processing ADSL to have grouping factor (ARM here) with 2 levels
#' ADSL <- cards::ADSL |>
#' dplyr::filter(ARM %in% c("Placebo", "Xanomeline High Dose")) |>
Expand Down
6 changes: 3 additions & 3 deletions R/ard_survival_survfit.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ ard_survival_survfit <- function(x, times = NULL, probs = NULL, type = NULL) {
#'
#' @return a `tibble`
#'
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom"), reference_pkg = "cardx"))
#' survival::survfit(survival::Surv(AVAL, CNSR) ~ TRTA, cards::ADTTE) |>
#' cardx:::.process_survfit_time(times = c(60, 180), type = "risk")
#'
Expand Down Expand Up @@ -221,7 +221,7 @@ ard_survival_survfit <- function(x, times = NULL, probs = NULL, type = NULL) {
#'
#' @return a `tibble`
#'
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "survival", reference_pkg = "cardx"))
#' survival::survfit(survival::Surv(AVAL, CNSR) ~ TRTA, cards::ADTTE) |>
#' cardx:::.process_survfit_probs(probs = c(0.25, 0.75))
#'
Expand Down Expand Up @@ -281,7 +281,7 @@ extract_multi_strata <- function(x, df_stat) {
#'
#' @return an ARD data frame of class 'card'
#'
#' @examples
#' @examplesIf do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = c("survival", "broom"), reference_pkg = "cardx"))
#' cardx:::.format_survfit_results(
#' broom::tidy(survival::survfit(survival::Surv(AVAL, CNSR) ~ TRTA, cards::ADTTE))
#' )
Expand Down
1 change: 1 addition & 0 deletions R/proportion_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ proportion_ci_strat_wilson <- function(x,
#' @seealso [proportion_ci_strat_wilson()]
#'
#' @keywords internal
#'
#' @examples
#' strata_data <- table(data.frame(
#' "f1" = sample(c(TRUE, FALSE), 100, TRUE),
Expand Down
2 changes: 2 additions & 0 deletions man/dot-format_cohens_d_results.Rd

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

2 changes: 2 additions & 0 deletions man/dot-format_hedges_g_results.Rd

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

3 changes: 2 additions & 1 deletion man/dot-format_mcnemartest_results.Rd

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

2 changes: 2 additions & 0 deletions man/dot-format_moodtest_results.Rd

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

3 changes: 2 additions & 1 deletion man/dot-format_survfit_results.Rd

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

2 changes: 2 additions & 0 deletions man/dot-format_ttest_results.Rd

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

3 changes: 2 additions & 1 deletion man/dot-format_wilcoxtest_results.Rd

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

3 changes: 2 additions & 1 deletion man/dot-process_survfit_probs.Rd

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

3 changes: 2 additions & 1 deletion man/dot-process_survfit_time.Rd

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

0 comments on commit 90f2c23

Please sign in to comment.