Skip to content

Commit

Permalink
Merge pull request #123 from sunroofgod/effsize
Browse files Browse the repository at this point in the history
Effsize
  • Loading branch information
sunroofgod committed Aug 21, 2023
2 parents 3dab5d3 + 1870d58 commit d864a33
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 48 deletions.
5 changes: 5 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@
^docs$
^pkgdown$
^\.github$
^README\.Rmd$
^CODE_OF_CONDUCT.md$
^CONTRIBUTING.MD$
^figures$
^dabestr.Rmd$
58 changes: 29 additions & 29 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
# # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
# on:
# push:
# branches: [dev]
# pull_request:
# branches: [dev]
#
# name: R-CMD-check
#
# jobs:
# R-CMD-check:
# runs-on: ubuntu-latest
# env:
# GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
# R_KEEP_PKG_SOURCE: yes
# steps:
# - uses: actions/checkout@v3
#
# - uses: r-lib/actions/setup-r@v2
# with:
# use-public-rspm: true
#
# - uses: r-lib/actions/setup-r-dependencies@v2
# with:
# extra-packages: any::rcmdcheck
# needs: check
#
# - uses: r-lib/actions/check-r-package@v2
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [dev]
pull_request:
branches: [dev]

name: R-CMD-check

jobs:
R-CMD-check:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes
steps:
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: dabestr
Type: Package
Title: Data Analysis using Bootstrap-Coupled Estimation
Version: 0.0.0.9000
Version: 1.0.0.0
Authors@R: c(
person("Kah Seng", "Lian", email = "kahseng@u.nus.edu", role = c("cre", "aut")),
person("Zhuoyu", "Wang", email = "wzhuoyu21@u.nus,edu", role = c("aut")),
Expand Down
5 changes: 3 additions & 2 deletions R/001_api.R
Original file line number Diff line number Diff line change
Expand Up @@ -354,12 +354,13 @@ load <- function(
#' print(dabest_obj)
#'
#' @export
print.dabest <- function(dabest_obj, ...) {
if (class(dabest_obj)[1] != "dabest") {
print.dabest <- function(x, ...) {
if (class(x)[1] != "dabest") {
cli::cli_abort(c("Only dabest class can be used.",
"x" = "Please enter a valid entry into the function."))
}

dabest_obj <- x
print_greeting_header()

paired <- dabest_obj$paired
Expand Down
9 changes: 5 additions & 4 deletions R/001_effsize_func.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
#' The following effect sizes `mean_diff`, `median_diff`, `cohens_d`, `hedges_g` and `cliffs_delta`
#' are used for most plot types.
#'
#' @param `dabest_obj` A dabest_obj created by loading in dataset along with other
#' @param dabest_obj A dabest_obj created by loading in dataset along with other
#' specified parameters with the [load()] function.
#' @param `perm_count` The number of reshuffles of control and test labels to be performed for each p-value.
#' @param perm_count The number of reshuffles of control and test labels to be performed for each p-value.
#'
#' @returns
#' Returns a `dabest_effectsize_obj` list with 22 elements. The following are the elements contained within:
Expand Down Expand Up @@ -312,12 +312,13 @@ hedges_correction <- function(x1, x2) {
#' print(dabest_obj.mean_diff)
#'
#' @export
print.dabest_effectsize <- function(dabest_effectsize_obj, ...) {
if (class(dabest_effectsize_obj) != "dabest_effectsize") {
print.dabest_effectsize <- function(x, ...) {
if (class(x) != "dabest_effectsize") {
cli::cli_abort(c("Only dabest_effectsize objects can be used.",
"x" = "Please enter a valid entry into the function."))
}

dabest_effectsize_obj <- x
print_greeting_header()

paired <- dabest_effectsize_obj$paired
Expand Down
12 changes: 3 additions & 9 deletions R/002_plot_themes.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,19 @@ float_contrast_theme <- ggplot2::theme(plot.margin = ggplot2::unit(c(0, 0, 0, 0)
axis.title.x = ggplot2::element_blank(),
axis.ticks.x = ggplot2::element_blank(),
axis.title.x.bottom = ggplot2::element_blank(),
legend.title = ggplot2::element_blank(),
axis.text = ggplot2::element_text(family = "sans"),
axis.title.y = ggplot2::element_text(family = "sans"))
legend.title = ggplot2::element_blank())

# Theme for top-down graph
non_float_contrast_theme <- ggplot2::theme(plot.margin = ggplot2::unit(c(0, 0, 0, 0), "pt"),
axis.line.x = ggplot2::element_blank(),
axis.title.x = ggplot2::element_blank(),
axis.ticks.x = ggplot2::element_blank(),
axis.title.x.bottom = ggplot2::element_blank(),
legend.title = ggplot2::element_blank(),
axis.text = ggplot2::element_text(family = "sans"),
axis.title.y = ggplot2::element_text(family = "sans"))
legend.title = ggplot2::element_blank())

# Theme for removal of all axes and labels
remove_all_axes_theme <- ggplot2::theme(axis.line = ggplot2::element_blank(),
axis.title = ggplot2::element_blank(),
axis.ticks = ggplot2::element_blank(),
legend.title = ggplot2::element_blank(),
plot.margin = ggplot2::unit(c(0, 0, 0, 0), "pt"),
axis.text = ggplot2::element_text(family = "sans"),
axis.title.y = ggplot2::element_text(family = "sans"))
plot.margin = ggplot2::unit(c(0, 0, 0, 0), "pt"))
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ git clone https://github.com/ACCLAB/dabestr
## Usage

``` r
library(dabestr)
#>
#> Attaching package: 'dabestr'
#> The following object is masked from 'package:base':
#>
#> load

data(twogroup_data)

dabest_obj.mean_diff <- dabestr::load(data = twogroup_data,
Expand All @@ -61,7 +68,7 @@ dabest_obj.mean_diff <- dabestr::load(data = twogroup_data,
dabest_plot(dabest_obj.mean_diff, TRUE)
```

![](man/figures/README-unnamed-chunk-4-1.png)<!-- -->
![](man/figures/README-unnamed-chunk-3-1.png)<!-- -->

## Citation

Expand Down
4 changes: 2 additions & 2 deletions man/effect_size.Rd

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

Binary file modified man/figures/README-unnamed-chunk-3-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d864a33

Please sign in to comment.