Skip to content

Commit

Permalink
Merge branch 'develop-0.6.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
aphalo committed Nov 13, 2024
2 parents 2955961 + 089f4e6 commit dcfe179
Show file tree
Hide file tree
Showing 72 changed files with 1,033 additions and 971 deletions.
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: ggpmisc
Type: Package
Title: Miscellaneous Extensions to 'ggplot2'
Version: 0.6.0-1
Date: 2024-06-26
Version: 0.6.1
Date: 2024-11-13
Authors@R:
c(
person("Pedro J.", "Aphalo", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-3385-972X")),
Expand Down Expand Up @@ -59,5 +59,5 @@ URL: https://docs.r4photobiology.info/ggpmisc/,
https://github.com/aphalo/ggpmisc
BugReports: https://github.com/aphalo/ggpmisc/issues
Encoding: UTF-8
RoxygenNote: 7.3.1
RoxygenNote: 7.3.2
VignetteBuilder: knitr
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ editor_options:
wrap: 72
---

# ggpmisc 0.6.1

- Fix warning with current 'broom' and upcoming 'ggplot2'.
- Make order of formal parameters in stats consistent with that in current 'ggplot2'.

# ggpmisc 0.6.0-1

- Add ellipsis parameter (`...`) to `use_label()` so that in addition to a character vector of label names passed to parameter `labels`, separate strings for each name are now also accepted.
Expand Down
6 changes: 3 additions & 3 deletions R/stat-fit-broom-tb.R
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@
stat_fit_tb <- function(mapping = NULL,
data = NULL,
geom = "table_npc",
position = "identity",
...,
method = "lm",
method.args = list(formula = y ~ x),
n.min = 2L,
Expand All @@ -328,16 +330,14 @@ stat_fit_tb <- function(mapping = NULL,
p.digits = digits,
label.x = "center",
label.y = "top",
position = "identity",
table.theme = NULL,
table.rownames = FALSE,
table.colnames = TRUE,
table.hjust = 1,
parse = FALSE,
na.rm = FALSE,
show.legend = FALSE,
inherit.aes = TRUE,
...) {
inherit.aes = TRUE) {
ggplot2::layer(
stat = StatFitTb, data = data, mapping = mapping, geom = geom,
position = position, show.legend = show.legend, inherit.aes = inherit.aes,
Expand Down
65 changes: 43 additions & 22 deletions R/stat-fit-broom.R
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@
stat_fit_glance <- function(mapping = NULL,
data = NULL,
geom = "text_npc",
position = "identity",
...,
method = "lm",
method.args = list(formula = y ~ x),
n.min = 2L,
Expand All @@ -204,9 +206,9 @@ stat_fit_glance <- function(mapping = NULL,
label.y = "top",
hstep = 0,
vstep = 0.075,
position = "identity",
na.rm = FALSE, show.legend = FALSE,
inherit.aes = TRUE, ...) {
na.rm = FALSE,
show.legend = FALSE,
inherit.aes = TRUE) {
ggplot2::layer(
stat = StatFitGlance, data = data, mapping = mapping, geom = geom,
position = position, show.legend = show.legend, inherit.aes = inherit.aes,
Expand Down Expand Up @@ -483,7 +485,8 @@ StatFitGlance <-
#' passed to [generics::augment()] whether they are silently ignored or obeyed
#' depends on each specialization of [augment()], so do carefully read the
#' documentation for the version of [augment()] corresponding to the `method`
#' used to fit the model.
#' used to fit the model. Be aware that `se_fit = FALSE` is the default in
#' these methods even when supported.
#'
#' @family ggplot statistics for model fits
#'
Expand Down Expand Up @@ -526,6 +529,13 @@ StatFitGlance <-
#' stat_fit_augment(method = "lm",
#' method.args = list(formula = y ~ x))
#'
#' if (broom.installed)
#' ggplot(mtcars, aes(x = disp, y = mpg)) +
#' geom_point(aes(colour = factor(cyl))) +
#' stat_fit_augment(method = "lm",
#' augment.args = list(se_fit = TRUE),
#' method.args = list(formula = y ~ x + I(x^2)))
#'
#' # Residuals from regression by panel example
#' if (broom.installed)
#' ggplot(mtcars, aes(x = disp, y = mpg)) +
Expand All @@ -540,6 +550,7 @@ StatFitGlance <-
#' ggplot(mtcars, aes(x = disp, y = mpg, colour = factor(cyl))) +
#' geom_point() +
#' stat_fit_augment(method = "lm",
#' augment.args = list(se_fit = TRUE),
#' method.args = list(formula = y ~ x))
#'
#' # Residuals from regression by group example
Expand Down Expand Up @@ -574,16 +585,20 @@ StatFitGlance <-
#' stat_fit_augment(method = "rq")
#'
#'
stat_fit_augment <- function(mapping = NULL, data = NULL, geom = "smooth",
stat_fit_augment <- function(mapping = NULL,
data = NULL,
geom = "smooth",
position = "identity",
...,
method = "lm",
method.args = list(formula = y ~ x),
n.min = 2L,
augment.args = list(),
level = 0.95,
y.out = ".fitted",
position = "identity",
na.rm = FALSE, show.legend = FALSE,
inherit.aes = TRUE, ...) {
na.rm = FALSE,
show.legend = FALSE,
inherit.aes = TRUE) {
ggplot2::layer(
stat = StatFitAugment, data = data, mapping = mapping, geom = geom,
position = position, show.legend = show.legend, inherit.aes = inherit.aes,
Expand All @@ -607,14 +622,14 @@ stat_fit_augment <- function(mapping = NULL, data = NULL, geom = "smooth",
#' @usage NULL
#'
fit_augment_compute_group_fun <- function(data,
scales,
method,
method.args,
n.min,
augment.args,
level,
y.out,
...) {
scales,
method,
method.args,
n.min,
augment.args,
level,
y.out,
...) {
unAsIs <- function(X) {
if ("AsIs" %in% class(X)) {
class(X) <- class(X)[-match("AsIs", class(X))]
Expand Down Expand Up @@ -670,7 +685,8 @@ fit_augment_compute_group_fun <- function(data,
z[["t.value"]] <- rep_len(NA_real_, nrow(z))
}
if (!exists(".se.fit", z)) {
z[[".se.fit"]] <- rep_len(NA_real_, nrow(z))
# z[[".se.fit"]] <- rep_len(NA_real_, nrow(z)) # triggered warning!
z[[".se.fit"]] <- rep_len(0, nrow(z))
}
z[["fm.class"]] <- rep_len(fm.class[1], nrow(z))
z[["fm.method"]] <- rep_len(method.name, nrow(z))
Expand Down Expand Up @@ -894,18 +910,23 @@ StatFitAugment <-
#' after_stat(x_estimate),
#' after_stat(x_p.value))))
#'
stat_fit_tidy <- function(mapping = NULL, data = NULL, geom = "text_npc",
stat_fit_tidy <- function(mapping = NULL,
data = NULL,
geom = "text_npc",
position = "identity",
...,
method = "lm",
method.args = list(formula = y ~ x),
n.min = 2L,
tidy.args = list(),
label.x = "left", label.y = "top",
label.x = "left",
label.y = "top",
hstep = 0,
vstep = NULL,
sanitize.names = FALSE,
position = "identity",
na.rm = FALSE, show.legend = FALSE,
inherit.aes = TRUE, ...) {
na.rm = FALSE,
show.legend = FALSE,
inherit.aes = TRUE) {
ggplot2::layer(
stat = StatFitTidy, data = data, mapping = mapping, geom = geom,
position = position, show.legend = show.legend, inherit.aes = inherit.aes,
Expand Down
23 changes: 13 additions & 10 deletions R/stat-fit-deviations.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,16 +171,19 @@
#'
#' @export
#'
stat_fit_deviations <- function(mapping = NULL, data = NULL, geom = "segment",
method = "lm",
method.args = list(),
n.min = 2L,
formula = NULL,
position = "identity",
na.rm = FALSE,
orientation = NA,
show.legend = FALSE,
inherit.aes = TRUE, ...) {
stat_fit_deviations <- function(mapping = NULL,
data = NULL,
geom = "segment",
position = "identity",
...,
method = "lm",
method.args = list(),
n.min = 2L,
formula = NULL,
na.rm = FALSE,
orientation = NA,
show.legend = FALSE,
inherit.aes = TRUE) {
ggplot2::layer(
stat = StatFitDeviations, data = data, mapping = mapping, geom = geom,
position = position, show.legend = show.legend, inherit.aes = inherit.aes,
Expand Down
5 changes: 3 additions & 2 deletions R/stat-fit-residuals.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,17 +171,18 @@
stat_fit_residuals <- function(mapping = NULL,
data = NULL,
geom = "point",
position = "identity",
...,
method = "lm",
method.args = list(),
n.min = 2L,
formula = NULL,
resid.type = NULL,
weighted = FALSE,
position = "identity",
na.rm = FALSE,
orientation = NA,
show.legend = FALSE,
inherit.aes = TRUE, ...) {
inherit.aes = TRUE) {
ggplot2::layer(
stat = StatFitResiduals, data = data, mapping = mapping, geom = geom,
position = position, show.legend = show.legend, inherit.aes = inherit.aes,
Expand Down
3 changes: 2 additions & 1 deletion R/stat-ma-eq.R
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,8 @@
#'
#' @export
#'
stat_ma_eq <- function(mapping = NULL, data = NULL,
stat_ma_eq <- function(mapping = NULL,
data = NULL,
geom = "text_npc",
position = "identity",
...,
Expand Down
3 changes: 2 additions & 1 deletion R/stat-multcomp.R
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@
#'
#' @export
#'
stat_multcomp <- function(mapping = NULL, data = NULL,
stat_multcomp <- function(mapping = NULL,
data = NULL,
geom = NULL,
position = "identity",
...,
Expand Down
12 changes: 6 additions & 6 deletions R/stat-peaks.R
Original file line number Diff line number Diff line change
Expand Up @@ -265,18 +265,18 @@ find_peaks <-
stat_peaks <- function(mapping = NULL,
data = NULL,
geom = "point",
position = "identity",
...,
span = 5,
ignore_threshold = 0,
strict = FALSE,
label.fmt = NULL,
x.label.fmt = NULL,
y.label.fmt = NULL,
orientation = "x",
position = "identity",
na.rm = FALSE,
show.legend = FALSE,
inherit.aes = TRUE,
...) {
inherit.aes = TRUE) {
ggplot2::layer(
stat = StatPeaks,
data = data,
Expand Down Expand Up @@ -507,18 +507,18 @@ StatPeaks <-
stat_valleys <- function(mapping = NULL,
data = NULL,
geom = "point",
position = "identity",
...,
span = 5,
ignore_threshold = 0,
strict = FALSE,
label.fmt = NULL,
x.label.fmt = NULL,
y.label.fmt = NULL,
orientation = "x",
position = "identity",
na.rm = FALSE,
show.legend = FALSE,
inherit.aes = TRUE,
...) {
inherit.aes = TRUE) {
ggplot2::layer(
stat = StatValleys,
data = data,
Expand Down
3 changes: 2 additions & 1 deletion R/stat-poly-eq.R
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,8 @@
#'
#' @export
#'
stat_poly_eq <- function(mapping = NULL, data = NULL,
stat_poly_eq <- function(mapping = NULL,
data = NULL,
geom = "text_npc",
position = "identity",
...,
Expand Down
6 changes: 4 additions & 2 deletions R/stat-poly-line.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,10 @@
#'
#' @export
#'
stat_poly_line <- function(mapping = NULL, data = NULL,
geom = "smooth", position = "identity",
stat_poly_line <- function(mapping = NULL,
data = NULL,
geom = "smooth",
position = "identity",
...,
method = "lm",
formula = NULL,
Expand Down
49 changes: 25 additions & 24 deletions R/stat-quant-eq.R
Original file line number Diff line number Diff line change
Expand Up @@ -436,30 +436,31 @@
#'
#' @export
#'
stat_quant_eq <- function(mapping = NULL, data = NULL,
geom = "text_npc",
position = "identity",
...,
formula = NULL,
quantiles = c(0.25, 0.5, 0.75),
method = "rq:br",
method.args = list(),
n.min = 3L,
eq.with.lhs = TRUE,
eq.x.rhs = NULL,
coef.digits = 3,
coef.keep.zeros = TRUE,
decreasing = getOption("ggpmisc.decreasing.poly.eq", FALSE),
rho.digits = 4,
label.x = "left", label.y = "top",
hstep = 0,
vstep = NULL,
output.type = NULL,
na.rm = FALSE,
orientation = NA,
parse = NULL,
show.legend = FALSE,
inherit.aes = TRUE) {
stat_quant_eq <- function(mapping = NULL,
data = NULL,
geom = "text_npc",
position = "identity",
...,
formula = NULL,
quantiles = c(0.25, 0.5, 0.75),
method = "rq:br",
method.args = list(),
n.min = 3L,
eq.with.lhs = TRUE,
eq.x.rhs = NULL,
coef.digits = 3,
coef.keep.zeros = TRUE,
decreasing = getOption("ggpmisc.decreasing.poly.eq", FALSE),
rho.digits = 4,
label.x = "left", label.y = "top",
hstep = 0,
vstep = NULL,
output.type = NULL,
na.rm = FALSE,
orientation = NA,
parse = NULL,
show.legend = FALSE,
inherit.aes = TRUE) {
# we guess formula from orientation
if (is.null(formula)) {
if (is.na(orientation) || orientation == "x") {
Expand Down
Loading

0 comments on commit dcfe179

Please sign in to comment.