Skip to content

Commit 60f0c0d

Browse files
rename functions with new package conventions. (#110)
**What changes are proposed in this pull request?** Functions are renamed according to new conventions: `ard_<pkgname>_<fnname>()` if a package specific function is used If a `.` appears in a function name it will be replaced with a `_` in the ard_*() function name. closes #106 @ayogasekaram -------------------------------------------------------------------------------- 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()` - [x] Request a reviewer Reviewer Checklist (if item does not apply, mark is as complete) - [x] If a bug was fixed, a unit test was added. - [x] Run `pkgdown::build_site()`. Check the R console for errors, and review the rendered website. - [x] Code coverage is suitable for any new functions/features: `devtools::test_coverage()` When the branch is ready to be merged: - [x] Update `NEWS.md` with the changes from this pull request under the heading "`# cards (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". --------- Co-authored-by: Daniel Sjoberg <danield.sjoberg@gmail.com>
1 parent 5062e97 commit 60f0c0d

File tree

79 files changed

+583
-452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+583
-452
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@ Pre-review Checklist (if item does not apply, mark is as complete)
1414
- [ ] If a bug was fixed, a unit test was added.
1515
- [ ] If a new `ard_*()` function was added, it passes the ARD structural checks from `cards::check_ard_structure()`.
1616
- [ ] Code coverage is suitable for any new functions/features (generally, 100% coverage for new code): `devtools::test_coverage()`
17-
- [ ] Request a reviewer
1817

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

2120
- [ ] If a bug was fixed, a unit test was added.
22-
- [ ] Run `pkgdown::build_site()`. Check the R console for errors, and review the rendered website.
2321
- [ ] Code coverage is suitable for any new functions/features: `devtools::test_coverage()`
2422

2523
When the branch is ready to be merged:
26-
- [ ] Update `NEWS.md` with the changes from this pull request under the heading "`# cards (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).
24+
- [ ] 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).
2725
- [ ] **All** GitHub Action workflows pass with a :white_check_mark:
2826
- [ ] Approve Pull Request
2927
- [ ] Merge the PR. Please use "Squash and merge" or "Rebase and merge".

NAMESPACE

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,33 @@ S3method(ard_regression,default)
44
export("%>%")
55
export(all_of)
66
export(any_of)
7-
export(ard_aov)
87
export(ard_car_anova)
9-
export(ard_chisqtest)
10-
export(ard_cohens_d)
11-
export(ard_fishertest)
12-
export(ard_hedges_g)
13-
export(ard_kruskaltest)
14-
export(ard_mcnemartest)
15-
export(ard_moodtest)
16-
export(ard_onewaytest)
17-
export(ard_paired_cohens_d)
18-
export(ard_paired_hedges_g)
19-
export(ard_paired_ttest)
20-
export(ard_paired_wilcoxtest)
8+
export(ard_car_vif)
9+
export(ard_effectsize_cohens_d)
10+
export(ard_effectsize_hedges_g)
11+
export(ard_effectsize_paired_cohens_d)
12+
export(ard_effectsize_paired_hedges_g)
2113
export(ard_proportion_ci)
22-
export(ard_proptest)
2314
export(ard_regression)
2415
export(ard_regression_basic)
25-
export(ard_smd)
26-
export(ard_survfit)
27-
export(ard_svychisq)
28-
export(ard_svycontinuous)
29-
export(ard_svyranktest)
30-
export(ard_svyttest)
31-
export(ard_ttest)
32-
export(ard_vif)
33-
export(ard_wilcoxtest)
16+
export(ard_smd_smd)
17+
export(ard_stats_aov)
18+
export(ard_stats_chisq_test)
19+
export(ard_stats_fisher_test)
20+
export(ard_stats_kruskal_test)
21+
export(ard_stats_mcnemar_test)
22+
export(ard_stats_mood_test)
23+
export(ard_stats_oneway_test)
24+
export(ard_stats_paired_t_test)
25+
export(ard_stats_paired_wilcox_test)
26+
export(ard_stats_prop_test)
27+
export(ard_stats_t_test)
28+
export(ard_stats_wilcox_test)
29+
export(ard_survey_svychisq)
30+
export(ard_survey_svycontinuous)
31+
export(ard_survey_svyranktest)
32+
export(ard_survey_svyttest)
33+
export(ard_survival_survfit)
3434
export(contains)
3535
export(ends_with)
3636
export(everything)

NEWS.md

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# cardx 0.1.0.9011
22

3+
### Breaking Changes
4+
5+
* Updated function names have been updated to follow the pattern `ard_<pkgname>_<fnname>()`. Former functions names have _not_ been deprecated. (#106)
6+
7+
```r
8+
ard_ttest() -> ard_stats_t_test()
9+
ard_paired_ttest() -> ard_stats_paired_t_test()
10+
ard_wilcoxtest() -> ard_stats_wilcox_test()
11+
ard_paired_wilcoxtest() -> ard_stats_paired_wilcox_test()
12+
ard_chisqtest() -> ard_stats_chisq_test()
13+
ard_fishertest() -> ard_stats_fisher_test()
14+
ard_kruskaltest() -> ard_stats_kruskal_test()
15+
ard_mcnemartest() -> ard_stats_mcnemar_test()
16+
ard_moodtest() -> ard_stats_mood_test()
17+
```
18+
19+
### New Features
20+
321
* Added the following functions for calculating Analysis Results Data (ARD).
422
- `ard_aov()` for calculating ANOVA results using `stats::aov()`. (#3)
523
- `ard_car_anova()` for calculating ANOVA results using `car::Anova()`. (#3)
@@ -15,9 +33,9 @@
1533
- `ard_svyranktest()` for weighted/survey rank tests using `survey::svyranktest()`. (#71)
1634
- `ard_vif()` for calculating the variance inflation factor using `car::vif()`. (#10)
1735

18-
* Updated functions `ard_ttest()`, `ard_paired_ttest()`, `ard_wilcoxtest()`, `ard_paired_wilcoxtest()`, `ard_chisqtest()`, `ard_fishertest()`, `ard_kruskaltest()`, `ard_mcnemartest()`, and `ard_moodtest()` to accept multiple variables at once. Independent tests are calculated for each variable. The `variable` argument is renamed to `variables`. (#77)
36+
* Updated functions `ard_stats_t_test()`, `ard_stats_paired_t_test()`, `ard_stats_wilcox_test()`, `ard_stats_paired_wilcox_test()`, `ard_stats_chisq_test()`, `ard_stats_fisher_test()`, `ard_stats_kruskal_test()`, `ard_stats_mcnemar_test()`, and `ard_stats_mood_test()` to accept multiple variables at once. Independent tests are calculated for each variable. The `variable` argument is renamed to `variables`. (#77)
1937

20-
* Updated `ard_ttest()` and `ard_wilcoxtest()` to no longer require the `by` argument, which yields central estimates with their confidence intervals. (#82)
38+
* Updated `ard_stats_t_test()` and `ard_stats_wilcox_test()` to no longer require the `by` argument, which yields central estimates with their confidence intervals. (#82)
2139

2240
# cardx 0.1.0
2341

R/ard_vif.R renamed to R/ard_car_vif.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
#' @param ... arguments passed to `car::vif(...)`
1111
#'
1212
#' @return data frame
13-
#' @name ard_vif
14-
#' @rdname ard_vif
13+
#' @name ard_car_vif
14+
#' @rdname ard_car_vif
1515
#' @export
1616
#'
1717
#' @examples
1818
#' lm(AGE ~ ARM + SEX, data = cards::ADSL) |>
19-
#' ard_vif()
20-
ard_vif <- function(x, ...) {
19+
#' ard_car_vif()
20+
ard_car_vif <- function(x, ...) {
2121
# check inputs ---------------------------------------------------------------
2222
check_not_missing(x)
2323

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
#' @param ... arguments passed to `effectsize::cohens_d(...)`
1717
#'
1818
#' @return ARD data frame
19-
#' @name ard_cohens_d
19+
#' @name ard_effectsize_cohens_d
2020
#'
2121
#' @details
22-
#' For the `ard_cohens_d()` function, the data is expected to be one row per subject.
22+
#' For the `ard_effectsize_cohens_d()` function, the data is expected to be one row per subject.
2323
#' The data is passed as `effectsize::cohens_d(data[[variable]]~data[[by]], data, paired = FALSE, ...)`.
2424
#'
25-
#' For the `ard_paired_cohens_d()` function, the data is expected to be one row
25+
#' For the `ard_effectsize_paired_cohens_d()` function, the data is expected to be one row
2626
#' per subject per by level. Before the effect size is calculated, the data are
2727
#' reshaped to a wide format to be one row per subject.
2828
#' The data are then passed as
@@ -31,7 +31,7 @@
3131
#' @examplesIf cards::is_pkg_installed(c("effectsize", "parameters"), reference_pkg = "cardx")
3232
#' cards::ADSL |>
3333
#' dplyr::filter(ARM %in% c("Placebo", "Xanomeline High Dose")) |>
34-
#' ard_cohens_d(by = ARM, variables = AGE)
34+
#' ard_effectsize_cohens_d(by = ARM, variables = AGE)
3535
#'
3636
#' # constructing a paired data set,
3737
#' # where patients receive both treatments
@@ -41,12 +41,12 @@
4141
#' dplyr::arrange(USUBJID, ARM) |>
4242
#' dplyr::group_by(USUBJID) |>
4343
#' dplyr::filter(dplyr::n() > 1) |>
44-
#' ard_paired_cohens_d(by = ARM, variables = AGE, id = USUBJID)
44+
#' ard_effectsize_paired_cohens_d(by = ARM, variables = AGE, id = USUBJID)
4545
NULL
4646

47-
#' @rdname ard_cohens_d
47+
#' @rdname ard_effectsize_cohens_d
4848
#' @export
49-
ard_cohens_d <- function(data, by, variables, ...) {
49+
ard_effectsize_cohens_d <- function(data, by, variables, ...) {
5050
# check installed packages ---------------------------------------------------
5151
cards::check_pkg_installed(c("effectsize", "parameters"), reference_pkg = "cardx")
5252

@@ -85,9 +85,9 @@ ard_cohens_d <- function(data, by, variables, ...) {
8585
}
8686

8787

88-
#' @rdname ard_cohens_d
88+
#' @rdname ard_effectsize_cohens_d
8989
#' @export
90-
ard_paired_cohens_d <- function(data, by, variables, id, ...) {
90+
ard_effectsize_paired_cohens_d <- function(data, by, variables, id, ...) {
9191
# check installed packages ---------------------------------------------------
9292
cards::check_pkg_installed("effectsize", reference_pkg = "cardx")
9393
cards::check_pkg_installed("parameters", reference_pkg = "cardx")
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@
1616
#' @param ... arguments passed to `effectsize::hedges_g(...)`
1717
#'
1818
#' @return ARD data frame
19-
#' @name ard_hedges_g
19+
#' @name ard_effectsize_hedges_g
2020
#'
2121
#' @details
22-
#' For the `ard_hedges_g()` function, the data is expected to be one row per subject.
22+
#' For the `ard_effectsize_hedges_g()` function, the data is expected to be one row per subject.
2323
#' The data is passed as `effectsize::hedges_g(data[[variable]]~data[[by]], data, paired = FALSE, ...)`.
2424
#'
25-
#' For the `ard_paired_hedges_g()` function, the data is expected to be one row
25+
#' For the `ard_effectsize_paired_hedges_g()` function, the data is expected to be one row
2626
#' per subject per by level. Before the effect size is calculated, the data are
2727
#' reshaped to a wide format to be one row per subject.
2828
#' The data are then passed as
@@ -31,7 +31,7 @@
3131
#' @examplesIf cards::is_pkg_installed(c("effectsize", "parameters", "withr"), reference_pkg = "cardx")
3232
#' cards::ADSL |>
3333
#' dplyr::filter(ARM %in% c("Placebo", "Xanomeline High Dose")) |>
34-
#' ard_hedges_g(by = ARM, variables = AGE)
34+
#' ard_effectsize_hedges_g(by = ARM, variables = AGE)
3535
#'
3636
#' # constructing a paired data set,
3737
#' # where patients receive both treatments
@@ -41,12 +41,12 @@
4141
#' dplyr::arrange(USUBJID, ARM) |>
4242
#' dplyr::group_by(USUBJID) |>
4343
#' dplyr::filter(dplyr::n() > 1) |>
44-
#' ard_paired_hedges_g(by = ARM, variables = AGE, id = USUBJID)
44+
#' ard_effectsize_paired_hedges_g(by = ARM, variables = AGE, id = USUBJID)
4545
NULL
4646

47-
#' @rdname ard_hedges_g
47+
#' @rdname ard_effectsize_hedges_g
4848
#' @export
49-
ard_hedges_g <- function(data, by, variables, ...) {
49+
ard_effectsize_hedges_g <- function(data, by, variables, ...) {
5050
# check installed packages ---------------------------------------------------
5151
cards::check_pkg_installed(c("effectsize", "parameters", "withr"), reference_pkg = "cardx")
5252

@@ -89,9 +89,9 @@ ard_hedges_g <- function(data, by, variables, ...) {
8989
dplyr::bind_rows()
9090
}
9191

92-
#' @rdname ard_hedges_g
92+
#' @rdname ard_effectsize_hedges_g
9393
#' @export
94-
ard_paired_hedges_g <- function(data, by, variables, id, ...) {
94+
ard_effectsize_paired_hedges_g <- function(data, by, variables, id, ...) {
9595
# check installed packages ---------------------------------------------------
9696
cards::check_pkg_installed("effectsize", reference_pkg = "cardx")
9797
cards::check_pkg_installed("parameters", reference_pkg = "cardx")

R/ard_smd.R renamed to R/ard_smd_smd.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
#' @export
1818
#'
1919
#' @examplesIf cards::is_pkg_installed("smd", reference_pkg = "cardx")
20-
#' ard_smd(cards::ADSL, by = ARM, variables = AGE, std.error = TRUE)
21-
#' ard_smd(cards::ADSL, by = ARM, variables = AGEGR1, std.error = TRUE)
22-
ard_smd <- function(data, by, variables, ...) {
20+
#' ard_smd_smd(cards::ADSL, by = ARM, variables = AGE, std.error = TRUE)
21+
#' ard_smd_smd(cards::ADSL, by = ARM, variables = AGEGR1, std.error = TRUE)
22+
ard_smd_smd <- function(data, by, variables, ...) {
2323
# check installed packages ---------------------------------------------------
2424
cards::check_pkg_installed("smd", reference_pkg = "cardx")
2525

R/ard_aov.R renamed to R/ard_stats_aov.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
#' @export
1212
#'
1313
#' @examplesIf cards::is_pkg_installed(c("broom.helpers"), reference_pkg = "cardx")
14-
#' ard_aov(AGE ~ ARM, data = cards::ADSL)
15-
ard_aov <- function(formula, data, ...) {
14+
#' ard_stats_aov(AGE ~ ARM, data = cards::ADSL)
15+
ard_stats_aov <- function(formula, data, ...) {
1616
# check installed packages ---------------------------------------------------
1717
cards::check_pkg_installed(c("broom.helpers"), reference_pkg = "cardx")
1818

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#'
2020
#' @examplesIf cards::is_pkg_installed("broom", reference_pkg = "cardx")
2121
#' cards::ADSL |>
22-
#' ard_chisqtest(by = "ARM", variables = "AGEGR1")
23-
ard_chisqtest <- function(data, by, variables, ...) {
22+
#' ard_stats_chisq_test(by = "ARM", variables = "AGEGR1")
23+
ard_stats_chisq_test <- function(data, by, variables, ...) {
2424
# check installed packages ---------------------------------------------------
2525
cards::check_pkg_installed("broom", reference_pkg = "cardx")
2626

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#'
2020
#' @examplesIf cards::is_pkg_installed("broom", reference_pkg = "cardx")
2121
#' cards::ADSL[1:30, ] |>
22-
#' ard_fishertest(by = "ARM", variables = "AGEGR1")
23-
ard_fishertest <- function(data, by, variables, ...) {
22+
#' ard_stats_fisher_test(by = "ARM", variables = "AGEGR1")
23+
ard_stats_fisher_test <- function(data, by, variables, ...) {
2424
# check installed packages ---------------------------------------------------
2525
cards::check_pkg_installed("broom", reference_pkg = "cardx")
2626

0 commit comments

Comments
 (0)