Skip to content

Commit

Permalink
Adding method to effectsize pkg ard functions (#144)
Browse files Browse the repository at this point in the history
**What changes are proposed in this pull request?**
* Style this entry in a way that can be copied directly into `NEWS.md`.
(#<issue number>, @<username>)

Provide more detail here as needed.

**Reference GitHub issue associated with pull request.** _e.g., 'closes
#<issue number>'_



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

Pre-review Checklist (if item does not apply, mark is as complete)
- [ ] **All** GitHub Action workflows pass with a ✅
- [ ] PR branch has pulled the most recent updates from master branch:
`usethis::pr_merge_main()`
- [ ] If a bug was fixed, a unit test was added.
- [ ] If a new `ard_*()` function was added, it passes the ARD
structural checks from `cards::check_ard_structure()`.
- [ ] If a new `ard_*()` function was added, `set_cli_abort_call()` has
been set.
- [ ] If a new `ard_*()` function was added and it depends on another
package (such as, `broom`), `is_pkg_installed("broom", reference_pkg =
"cardx")` has been set in the function call and the following added to
the roxygen comments: `@examplesIf
do.call(asNamespace("cardx")$is_pkg_installed, list(pkg = "broom"",
reference_pkg = "cardx"))`
- [ ] 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
ddsjoberg authored May 6, 2024
1 parent 1a4e5c1 commit 239bf36
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions R/ard_effectsize_cohens_d.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ ard_effectsize_cohens_d <- function(data, by, variables, conf.level = 0.95, ...)
lst_tidy =
cards::eval_capture_conditions(
effectsize::cohens_d(data[[variable]] ~ data[[by]], data = data, paired = FALSE, ci = conf.level, ...) |>
parameters::standardize_names(style = "broom")
parameters::standardize_names(style = "broom") |>
dplyr::mutate(method = "Cohen's D")
),
paired = FALSE,
...
Expand Down Expand Up @@ -127,7 +128,8 @@ ard_effectsize_paired_cohens_d <- function(data, by, variables, id, conf.level =
data_wide <- .paired_data_pivot_wider(data, by = by, variable = variable, id = id)
# perform paired cohen's d test
effectsize::cohens_d(x = data_wide[["by1"]], y = data_wide[["by2"]], paired = TRUE, ci = conf.level, ...) |>
parameters::standardize_names(style = "broom")
parameters::standardize_names(style = "broom") |>
dplyr::mutate(method = "Paired Cohen's D")
}),
paired = TRUE,
...
Expand Down
6 changes: 4 additions & 2 deletions R/ard_effectsize_hedges_g.R
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ ard_effectsize_hedges_g <- function(data, by, variables, conf.level = 0.95, ...)
package = "effectsize",
code = hedges_g(data[[variable]] ~ data[[by]], paired = FALSE, ci = conf.level, ...)
) |>
parameters::standardize_names(style = "broom")
parameters::standardize_names(style = "broom") |>
dplyr::mutate(method = "Hedge's G")
),
paired = FALSE,
...
Expand Down Expand Up @@ -135,7 +136,8 @@ ard_effectsize_paired_hedges_g <- function(data, by, variables, id, conf.level =
package = "effectsize",
code = hedges_g(x = data_wide[["by1"]], y = data_wide[["by2"]], paired = TRUE, ci = conf.level, ...)
) |>
parameters::standardize_names(style = "broom")
parameters::standardize_names(style = "broom") |>
dplyr::mutate(method = "Paired Hedge's G")
}),
paired = TRUE,
...
Expand Down

0 comments on commit 239bf36

Please sign in to comment.