juliasilge / tidytext

Compare 72610d9 ... +0 ... a208573

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 1 of 6 files from the diff.

@@ -14,7 +14,9 @@
Loading
14 14
#' variables.
15 15
#' @param fun Function to perform within each subset to determine the resulting
16 16
#' ordering. By default, mean.
17 -
#' @param sep Separator to distinguish the two. You may want to set this
17 +
#' @param labels Function to transform the labels of
18 +
#' [ggplot2::scale_x_discrete()], by default `reorder_func`.
19 +
#' @param sep Separator to distinguish `by` and `within`. You may want to set this
18 20
#' manually if ___ can exist within one of your labels.
19 21
#' @param ... In \code{reorder_within} arguments passed on to
20 22
#' \code{\link{reorder}}. In the scale functions, extra arguments passed on to
@@ -49,6 +51,7 @@
Loading
49 51
#'   scale_x_reordered() +
50 52
#'   facet_wrap(vs ~ am, scales = "free_x")
51 53
#'
54 +
#' @importFrom lifecycle deprecated
52 55
#' @export
53 56
reorder_within <- function(x, by, within, fun = mean, sep = "___", ...) {
54 57
  if (!is.list(within)) {
@@ -62,15 +65,39 @@
Loading
62 65
63 66
#' @rdname reorder_within
64 67
#' @export
65 -
scale_x_reordered <- function(..., sep = "___") {
66 -
  reg <- paste0(sep, ".+$")
67 -
  ggplot2::scale_x_discrete(labels = function(x) gsub(reg, "", x), ...)
68 +
scale_x_reordered <- function(..., labels = reorder_func, sep = deprecated()) {
69 +
70 +
  if (lifecycle::is_present(sep)) {
71 +
    lifecycle::deprecate_soft(
72 +
      "0.3.3",
73 +
      "scale_x_reordered(sep = )",
74 +
      "reorder_func(sep = )"
75 +
    )
76 +
  }
77 +
78 +
  ggplot2::scale_x_discrete(labels = labels, ...)
68 79
}
69 80
70 81
71 82
#' @rdname reorder_within
72 83
#' @export
73 -
scale_y_reordered <- function(..., sep = "___") {
84 +
scale_y_reordered <- function(..., labels = reorder_func, sep = deprecated()) {
85 +
86 +
  if (lifecycle::is_present(sep)) {
87 +
    lifecycle::deprecate_soft(
88 +
      "0.3.3",
89 +
      "scale_y_reordered(sep = )",
90 +
      "reorder_func(sep = )"
91 +
    )
92 +
  }
93 +
94 +
  ggplot2::scale_y_discrete(labels = labels, ...)
95 +
}
96 +
97 +
#' @rdname reorder_within
98 +
#' @export
99 +
reorder_func <- function(x, sep = "___") {
74 100
  reg <- paste0(sep, ".+$")
75 -
  ggplot2::scale_y_discrete(labels = function(x) gsub(reg, "", x), ...)
101 +
  gsub(reg, "", x)
76 102
}
103 +

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
R -1.34% 81.70%
Project Totals (19 files) 81.70%
Loading