Skip to content

Commit

Permalink
Merge pull request #309 from IndrajeetPatil/purrrlyr_removal
Browse files Browse the repository at this point in the history
get rid of purrrlyr and ellipsis dependencies
  • Loading branch information
IndrajeetPatil authored Sep 13, 2019
2 parents 70c8efc + de7f5a1 commit e94e924
Show file tree
Hide file tree
Showing 67 changed files with 472 additions and 549 deletions.
7 changes: 2 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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
27 changes: 13 additions & 14 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
1 change: 0 additions & 1 deletion R/ggcoefstats.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion R/global_vars.R
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ utils::globalVariables(
"main",
"pair1",
"W",
"Parameter"
"Parameter",
"p.value.formatted"
),
package = "ggstatsplot",
add = FALSE
Expand Down
11 changes: 1 addition & 10 deletions R/helpers_ggbetweenstats_graphics.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
#'
Expand Down Expand Up @@ -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 +
Expand Down Expand Up @@ -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 %<>%
Expand Down Expand Up @@ -432,7 +426,6 @@ ggsignif_position_calculator <- function(x, y) {
#'
#' @importFrom forcats fct_reorder
#' @importFrom dplyr mutate
#' @importFrom ellipsis check_dots_used
#'
#' @inheritParams ggbetweenstats
#'
Expand All @@ -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") {
Expand Down Expand Up @@ -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(
Expand Down
60 changes: 36 additions & 24 deletions R/helpers_ggcatstats_graphics.R
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
}

Expand All @@ -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)
}
Loading

2 comments on commit e94e924

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R/ggbarstats.R:70:1: style: functions should have cyclomatic complexity of less than 15, this has 20.

ggbarstats <- function(data,
^

R/ggbetweenstats.R:196:1: style: functions should have cyclomatic complexity of less than 15, this has 33.

ggbetweenstats <- function(data,
^

R/ggcoefstats.R:302:1: style: functions should have cyclomatic complexity of less than 15, this has 59.

ggcoefstats <- function(x,
^

R/ggcorrmat.R:167:1: style: functions should have cyclomatic complexity of less than 15, this has 30.

ggcorrmat <- function(data,
^

R/gghistostats.R:79:1: style: functions should have cyclomatic complexity of less than 15, this has 24.

gghistostats <- function(data,
^

R/ggpiestats.R:110:1: style: functions should have cyclomatic complexity of less than 15, this has 22.

ggpiestats <- function(data,
^

R/ggscatterstats.R:95:1: style: functions should have cyclomatic complexity of less than 15, this has 34.

ggscatterstats <- function(data,
^

R/ggwithinstats.R:63:1: style: functions should have cyclomatic complexity of less than 15, this has 31.

ggwithinstats <- function(data,
^

R/helpers_gghistostats_graphics.R:48:5: warning: local variable ‘label.value’ assigned but may not be used

label.value <- x_pos
    ^~~~~~~~~~~

@lintr-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

R/ggbarstats.R:70:1: style: functions should have cyclomatic complexity of less than 15, this has 20.

ggbarstats <- function(data,
^

R/ggbetweenstats.R:196:1: style: functions should have cyclomatic complexity of less than 15, this has 33.

ggbetweenstats <- function(data,
^

R/ggcoefstats.R:302:1: style: functions should have cyclomatic complexity of less than 15, this has 59.

ggcoefstats <- function(x,
^

R/ggcorrmat.R:167:1: style: functions should have cyclomatic complexity of less than 15, this has 30.

ggcorrmat <- function(data,
^

R/gghistostats.R:79:1: style: functions should have cyclomatic complexity of less than 15, this has 24.

gghistostats <- function(data,
^

R/ggpiestats.R:110:1: style: functions should have cyclomatic complexity of less than 15, this has 22.

ggpiestats <- function(data,
^

R/ggscatterstats.R:95:1: style: functions should have cyclomatic complexity of less than 15, this has 34.

ggscatterstats <- function(data,
^

R/ggwithinstats.R:63:1: style: functions should have cyclomatic complexity of less than 15, this has 31.

ggwithinstats <- function(data,
^

R/helpers_gghistostats_graphics.R:48:5: warning: local variable ‘label.value’ assigned but may not be used

label.value <- x_pos
    ^~~~~~~~~~~

Please sign in to comment.