diff --git a/DESCRIPTION b/DESCRIPTION index e73c1c2f9..3b21a6f7b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -35,8 +35,7 @@ Imports: cowplot (>= 1.0.0), crayon (>= 1.3.4), dplyr (>= 0.8.3), - ellipsis (>= 0.2.0.1), - forcats, + forcats (>= 0.4.0), ggcorrplot (>= 0.1.3), ggExtra (>= 0.9), ggplot2 (>= 3.2.1), @@ -45,14 +44,12 @@ Imports: grid, groupedstats (>= 0.0.9), insight (>= 0.5.0), - magrittr, metaBMA (>= 0.6.1), metafor (>= 2.1-0), pairwiseComparisons (>= 0.1.0.9000), paletteer (>= 0.2.1), psych (>= 1.8.12), purrr (>= 0.3.2), - purrrlyr (>= 0.0.5), rlang (>= 0.4.0), scales (>= 1.0.0), sjstats (>= 0.17.5), @@ -83,4 +80,4 @@ Encoding: UTF-8 Language: en-US LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 6.1.1.9000 +RoxygenNote: 6.1.99.9000 diff --git a/NAMESPACE b/NAMESPACE index 87fca10d9..81f85a2f7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,10 +1,10 @@ # Generated by roxygen2: do not edit by hand -export("%$%") -export("%<>%") -export("%>%") -export("%|%") -export("%||%") +export(`%$%`) +export(`%<>%`) +export(`%>%`) +export(`%|%`) +export(`%||%`) export(as_tibble) export(bartlett_message) export(bf_meta_message) @@ -42,6 +42,9 @@ export(theme_pie) export(tibble) import(ggplot2) importFrom(WRS2,pball) +importFrom(broomExtra,"%$%") +importFrom(broomExtra,"%<>%") +importFrom(broomExtra,"%>%") importFrom(broomExtra,augment) importFrom(broomExtra,glance) importFrom(broomExtra,tidy) @@ -82,7 +85,6 @@ importFrom(dplyr,starts_with) importFrom(dplyr,summarize) importFrom(dplyr,ungroup) importFrom(dplyr,vars) -importFrom(ellipsis,check_dots_used) importFrom(forcats,fct_reorder) importFrom(ggExtra,ggMarginal) importFrom(ggcorrplot,ggcorrplot) @@ -99,9 +101,6 @@ importFrom(groupedstats,signif_column) importFrom(groupedstats,specify_decimal_p) importFrom(insight,find_statistic) importFrom(insight,is_model) -importFrom(magrittr,"%$%") -importFrom(magrittr,"%<>%") -importFrom(magrittr,"%>%") importFrom(metaBMA,meta_random) importFrom(metafor,rma) importFrom(pairwiseComparisons,p_adjust_text) @@ -111,7 +110,7 @@ importFrom(paletteer,scale_color_paletteer_d) importFrom(paletteer,scale_fill_paletteer_d) importFrom(psych,corr.p) importFrom(psych,corr.test) -importFrom(purrr,"%||%") +importFrom(purrr,`%||%`) importFrom(purrr,compose) importFrom(purrr,discard) importFrom(purrr,flatten_dbl) @@ -121,12 +120,12 @@ importFrom(purrr,is_bare_numeric) importFrom(purrr,keep) importFrom(purrr,map) importFrom(purrr,pmap) -importFrom(purrrlyr,by_row) -importFrom(rlang,"!!!") -importFrom(rlang,"!!") importFrom(rlang,"%|%") importFrom(rlang,"%||%") -importFrom(rlang,":=") +importFrom(rlang,`!!!`) +importFrom(rlang,`!!`) +importFrom(rlang,`%||%`) +importFrom(rlang,`:=`) importFrom(rlang,as_name) importFrom(rlang,as_string) importFrom(rlang,enexpr) diff --git a/R/ggcoefstats.R b/R/ggcoefstats.R index 876cc4bea..52f70b9dd 100644 --- a/R/ggcoefstats.R +++ b/R/ggcoefstats.R @@ -158,7 +158,6 @@ #' @importFrom dplyr select bind_rows summarize mutate mutate_at mutate_if n #' @importFrom dplyr group_by arrange full_join vars matches desc everything #' @importFrom dplyr vars all_vars filter_at starts_with row_number -#' @importFrom purrrlyr by_row #' @importFrom stats as.formula lm confint qnorm p.adjust #' @importFrom ggrepel geom_label_repel #' @importFrom grid unit diff --git a/R/global_vars.R b/R/global_vars.R index 0ad445462..483b9bf78 100644 --- a/R/global_vars.R +++ b/R/global_vars.R @@ -203,7 +203,8 @@ utils::globalVariables( "main", "pair1", "W", - "Parameter" + "Parameter", + "p.value.formatted" ), package = "ggstatsplot", add = FALSE diff --git a/R/helpers_ggbetweenstats_graphics.R b/R/helpers_ggbetweenstats_graphics.R index 71848e58a..80b704c7a 100644 --- a/R/helpers_ggbetweenstats_graphics.R +++ b/R/helpers_ggbetweenstats_graphics.R @@ -108,8 +108,7 @@ mean_labeller <- function(data, #' @inheritParams ggrepel::geom_label_repel #' #' @importFrom ggrepel geom_label_repel -#' @importFrom rlang !! enquo -#' @importFrom ellipsis check_dots_used +#' @importFrom rlang !! enquo ensym #' #' @examples #' @@ -152,10 +151,6 @@ mean_ggrepel <- function(plot, mean.label.color = "black", inherit.aes = TRUE, ...) { - - # check any misspecified arguments - ellipsis::check_dots_used() - # highlight the mean of each group if (isTRUE(inherit.aes)) { plot <- plot + @@ -263,7 +258,6 @@ outlier_df <- function(data, x <- rlang::ensym(x) y <- rlang::ensym(y) outlier.label <- rlang::ensym(outlier.label) - ellipsis::check_dots_used() # add a logical column indicating whether a point is or is not an outlier data %<>% @@ -432,7 +426,6 @@ ggsignif_position_calculator <- function(x, y) { #' #' @importFrom forcats fct_reorder #' @importFrom dplyr mutate -#' @importFrom ellipsis check_dots_used #' #' @inheritParams ggbetweenstats #' @@ -450,7 +443,6 @@ sort_xy <- function(data, # make sure both quoted and unquoted arguments are allowed x <- rlang::ensym(x) y <- rlang::ensym(y) - ellipsis::check_dots_used() # decide the needed order if (sort == "ascending") { @@ -500,7 +492,6 @@ aesthetic_addon <- function(plot, direction = 1, ggplot.component = NULL, ...) { - ellipsis::check_dots_used() # if no. of factor levels is greater than the default palette color count palette_message( diff --git a/R/helpers_ggcatstats_graphics.R b/R/helpers_ggcatstats_graphics.R index 9c90f2ba8..1bcd2d3a4 100644 --- a/R/helpers_ggcatstats_graphics.R +++ b/R/helpers_ggcatstats_graphics.R @@ -126,24 +126,31 @@ df_facet_label <- function(data, x, y, k = 3L) { by = rlang::as_name(rlang::ensym(y)) ) %>% p_value_formatter(df = ., k = k) %>% - purrrlyr::by_row( - .d = ., - ..f = ~ paste( - "list(~chi['gof']^2~", - "(", - .$parameter, - ")==", - specify_decimal_p(x = .$statistic, k = k), - ", ~italic(p)", - .$p.value.formatted, - ")", - sep = " " - ), - .collate = "rows", - .to = "label", - .labels = TRUE + dplyr::mutate(.data = ., rowid = dplyr::row_number()) %>% + dplyr::group_nest(.tbl = ., rowid) %>% + dplyr::mutate( + .data = ., + label = data %>% + purrr::map( + .x = ., + .f = ~ paste( + "list(~chi['gof']^2~", + "(", + .$parameter, + ")==", + specify_decimal_p(x = .$statistic, k = k), + ", ~italic(p)", + .$p.value.formatted, + ")", + sep = " " + ), + .collate = "rows", + .to = "label", + .labels = TRUE + ) ) %>% - dplyr::select(.data = ., -dplyr::matches("p.value.formatted")) + tidyr::unnest(data = ., c(label, data)) %>% + dplyr::select(.data = ., -rowid, -dplyr::matches("p.value.formatted")) } } @@ -153,18 +160,23 @@ df_facet_label <- function(data, x, y, k = 3L) { p_value_formatter <- function(df, k = 3L) { df %>% - purrrlyr::by_row( - .d = ., - ..f = ~ specify_decimal_p(x = .$p.value, k = k, p.value = TRUE), - .collate = "rows", - .to = "p.value.formatted", - .labels = TRUE + dplyr::mutate(.data = ., rowid = dplyr::row_number()) %>% + dplyr::group_nest(.tbl = ., rowid) %>% + dplyr::mutate( + .data = ., + p.value.formatted = data %>% + purrr::map( + .x = ., + .f = ~ specify_decimal_p(x = .$p.value, k = k, p.value = TRUE) + ) ) %>% + tidyr::unnest(data = ., cols = c(p.value.formatted, data)) %>% dplyr::mutate( .data = ., p.value.formatted = dplyr::case_when( p.value.formatted == "< 0.001" ~ "<= 0.001", TRUE ~ paste("==", p.value.formatted, sep = " ") ) - ) + ) %>% + dplyr::select(.data = ., -rowid) } diff --git a/R/helpers_ggcoefstats_graphics.R b/R/helpers_ggcoefstats_graphics.R index 2bfd83e63..769795639 100644 --- a/R/helpers_ggcoefstats_graphics.R +++ b/R/helpers_ggcoefstats_graphics.R @@ -141,7 +141,8 @@ ggcoefstats_label_maker <- function(x, .funs = ~ specify_decimal_p(x = ., k = k) ) %>% signif_column(data = ., p = p.value) %>% - p_value_formatter(df = ., k = k) + p_value_formatter(df = ., k = k) %>% + dplyr::mutate(.data = ., rowid = dplyr::row_number()) #--------------------------- t-statistic ------------------------------------ @@ -163,68 +164,74 @@ ggcoefstats_label_maker <- function(x, # adding a new column with residual df tidy_df %<>% - purrrlyr::by_row( - .d = ., - ..f = ~ paste( - "list(~italic(beta)==", - specify_decimal_p(x = .$estimate, k = k), - ", ~italic(t)", - "(", - specify_decimal_p(x = .$df.residual, k = 0L), - ")==", - .$statistic, - ", ~italic(p)", - .$p.value.formatted, - ")", - sep = "" - ), - .collate = "rows", - .to = "label", - .labels = TRUE + dplyr::group_nest(.tbl = ., rowid) %>% + dplyr::mutate( + .data = ., + label = data %>% + purrr::map( + .x = ., + .f = ~ paste( + "list(~italic(beta)==", + specify_decimal_p(x = .$estimate, k = k), + ", ~italic(t)", + "(", + specify_decimal_p(x = .$df.residual, k = 0L), + ")==", + .$statistic, + ", ~italic(p)", + .$p.value.formatted, + ")", + sep = "" + ) + ) ) } else { # for objects like `rlm` there will be no parameter tidy_df %<>% - purrrlyr::by_row( - .d = ., - ..f = ~ paste( - "list(~italic(beta)==", - specify_decimal_p(x = .$estimate, k = k), - ", ~italic(t)", - "==", - .$statistic, - ", ~italic(p)", - .$p.value.formatted, - ")", - sep = "" - ), - .collate = "rows", - .to = "label", - .labels = TRUE + dplyr::group_nest(.tbl = ., rowid) %>% + dplyr::mutate( + .data = ., + label = data %>% + purrr::map( + .x = ., + .f = ~ paste( + "list(~italic(beta)==", + specify_decimal_p(x = .$estimate, k = k), + ", ~italic(t)", + "==", + .$statistic, + ", ~italic(p)", + .$p.value.formatted, + ")", + sep = "" + ) + ) ) } } #--------------------------- z-statistic --------------------------------- + # if the statistic is z-value if (statistic %in% c("z", "z.value", "z-value", "Z")) { - # if the statistic is z-value tidy_df %<>% - purrrlyr::by_row( - .d = ., - ..f = ~ paste( - "list(~italic(beta)==", - specify_decimal_p(x = .$estimate, k = k), - ", ~italic(z)==", - .$statistic, - ", ~italic(p)", - .$p.value.formatted, - ")", - sep = "" - ), - .collate = "rows", - .to = "label", - .labels = TRUE + dplyr::group_nest(.tbl = ., rowid) %>% + dplyr::mutate( + .data = ., + label = data %>% + purrr::map( + .x = ., + .f = ~ paste( + "list(~italic(beta)==", + specify_decimal_p(x = .$estimate, k = k), + ", ~italic(z)==", + .$statistic, + ", ~italic(p)", + .$p.value.formatted, + ")", + sep = "" + ) + ) ) } @@ -250,31 +257,38 @@ ggcoefstats_label_maker <- function(x, # which effect size is needed? tidy_df %<>% - purrrlyr::by_row( - .d = ., - ..f = ~ paste( - "list(~italic(F)", - "(", - .$df1, - "*\",\"*", - .$df2, - ")==", - .$statistic, - ", ~italic(p)", - .$p.value.formatted, - ", ~", - .$effsize.text, - "==", - specify_decimal_p(x = .$estimate, k = k), - ")", - sep = "" - ), - .collate = "rows", - .to = "label", - .labels = TRUE + dplyr::group_nest(.tbl = ., rowid) %>% + dplyr::mutate( + .data = ., + label = data %>% + purrr::map( + .x = ., + .f = ~ paste( + "list(~italic(F)", + "(", + .$df1, + "*\",\"*", + .$df2, + ")==", + .$statistic, + ", ~italic(p)", + .$p.value.formatted, + ", ~", + .$effsize.text, + "==", + specify_decimal_p(x = .$estimate, k = k), + ")", + sep = "" + ) + ) ) } + # unnest + tidy_df %<>% + tidyr::unnest(data = ., cols = c(label, data)) %>% + dplyr::select(.data = ., -rowid) + # return the final dataframe return(tibble::as_tibble(tidy_df)) } diff --git a/R/helpers_messages.R b/R/helpers_messages.R index 2ac8d97c5..3fbde963a 100644 --- a/R/helpers_messages.R +++ b/R/helpers_messages.R @@ -42,7 +42,6 @@ normality_message <- function(x, k = 2, output = "message", ...) { - ellipsis::check_dots_used() # if label is not provided, use generic "x" variable if (is.null(lab)) lab <- "x" @@ -121,7 +120,6 @@ bartlett_message <- function(data, # make sure both quoted and unquoted arguments are supported x <- rlang::ensym(x) y <- rlang::ensym(y) - ellipsis::check_dots_used() # if `lab` is not provided, use the variable `x` name if (is.null(lab)) lab <- rlang::as_name(x) diff --git a/R/reexports.R b/R/reexports.R index ef844a8b7..7dd7e1e3f 100644 --- a/R/reexports.R +++ b/R/reexports.R @@ -20,16 +20,16 @@ groupedstats::set_cwd # ----------------------- tidyverse ------------------------------------- #' @export -#' @importFrom magrittr "%>%" -magrittr::`%>%` +#' @importFrom broomExtra "%>%" +broomExtra::`%>%` #' @export -#' @importFrom magrittr "%<>%" -magrittr::`%<>%` +#' @importFrom broomExtra "%<>%" +broomExtra::`%<>%` #' @export -#' @importFrom magrittr "%$%" -magrittr::`%$%` +#' @importFrom broomExtra "%$%" +broomExtra::`%$%` #' @export #' @importFrom rlang "%||%" diff --git a/codemeta.json b/codemeta.json index c765dda6e..c23522fd6 100644 --- a/codemeta.json +++ b/codemeta.json @@ -279,23 +279,11 @@ }, "sameAs": "https://CRAN.R-project.org/package=dplyr" }, - { - "@type": "SoftwareApplication", - "identifier": "ellipsis", - "name": "ellipsis", - "version": ">= 0.2.0.1", - "provider": { - "@id": "https://cran.r-project.org", - "@type": "Organization", - "name": "Comprehensive R Archive Network (CRAN)", - "url": "https://cran.r-project.org" - }, - "sameAs": "https://CRAN.R-project.org/package=ellipsis" - }, { "@type": "SoftwareApplication", "identifier": "forcats", "name": "forcats", + "version": ">= 0.4.0", "provider": { "@id": "https://cran.r-project.org", "@type": "Organization", @@ -400,18 +388,6 @@ }, "sameAs": "https://CRAN.R-project.org/package=insight" }, - { - "@type": "SoftwareApplication", - "identifier": "magrittr", - "name": "magrittr", - "provider": { - "@id": "https://cran.r-project.org", - "@type": "Organization", - "name": "Comprehensive R Archive Network (CRAN)", - "url": "https://cran.r-project.org" - }, - "sameAs": "https://CRAN.R-project.org/package=magrittr" - }, { "@type": "SoftwareApplication", "identifier": "metaBMA", @@ -490,19 +466,6 @@ }, "sameAs": "https://CRAN.R-project.org/package=purrr" }, - { - "@type": "SoftwareApplication", - "identifier": "purrrlyr", - "name": "purrrlyr", - "version": ">= 0.0.5", - "provider": { - "@id": "https://cran.r-project.org", - "@type": "Organization", - "name": "Comprehensive R Archive Network (CRAN)", - "url": "https://cran.r-project.org" - }, - "sameAs": "https://CRAN.R-project.org/package=purrrlyr" - }, { "@type": "SoftwareApplication", "identifier": "rlang", diff --git a/docs/articles/additional.html b/docs/articles/additional.html index 9cb148508..594127f7c 100644 --- a/docs/articles/additional.html +++ b/docs/articles/additional.html @@ -139,7 +139,7 @@

additional vignettes

Indrajeet Patil

-

2019-09-11

+

2019-09-13

Source: vignettes/additional.Rmd diff --git a/docs/articles/index.html b/docs/articles/index.html index 90381af1e..6378259a4 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -100,9 +100,6 @@
  • additional vignettes
  • -
  • - Tests and Coverage -
  • combine_plots
  • @@ -189,7 +186,6 @@

    All vignettes