Skip to content

Commit

Permalink
Merge branch 'develop-0.5.7'
Browse files Browse the repository at this point in the history
  • Loading branch information
aphalo committed May 21, 2024
2 parents 45c8899 + 93ecb7d commit edc7640
Show file tree
Hide file tree
Showing 17 changed files with 212 additions and 37 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ editor_options:
- Define function `check_poly_formula()` and use it in `stat_poly_eq()` and `stat_quant_eq()` to validate that the user-supplied model formula is a polynomial with terms in order of increasing powers. If not validated, `NA` is returned as formatted equation label.
- Statistics `stat_poly_eq()`, `stat_ma_eq()`, `stat_quant_eq()`, `stat_correlation()`, and `stat_multcomp()` were in part rewritten, introducing small visual changes in the formatting of labels, including changes in the default number of digits.
- Export new utility functions, used internally for formatting parameter estimates into character strings.
- Implement R options `ggpmisc.small.p`, `ggpmisc.small.r` and `ggpmisc.decreasing.poly.eq`.

# ggpmisc 0.5.6

Expand Down
4 changes: 2 additions & 2 deletions R/stat-correlation.R
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ stat_correlation <-
r.conf.level =
ifelse(method == "pearson", 0.95, NA),
continuity = FALSE,
small.r = FALSE,
small.p = FALSE,
small.r = getOption("ggpmisc.small.r", default = FALSE),
small.p = getOption("ggpmisc.small.p", default = FALSE),
coef.keep.zeros = TRUE,
r.digits = 2,
t.digits = 3,
Expand Down
6 changes: 3 additions & 3 deletions R/stat-ma-eq.R
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,11 @@ stat_ma_eq <- function(mapping = NULL, data = NULL,
nperm = 99,
eq.with.lhs = TRUE,
eq.x.rhs = NULL,
small.r = FALSE,
small.p = FALSE,
small.r = getOption("ggpmisc.small.r", default = FALSE),
small.p = getOption("ggpmisc.small.p", default = FALSE),
coef.digits = 3,
coef.keep.zeros = TRUE,
decreasing = FALSE,
decreasing = getOption("ggpmisc.decreasing.poly.eq", FALSE),
rr.digits = 2,
theta.digits = 2,
p.digits = max(1, ceiling(log10(nperm))),
Expand Down
2 changes: 1 addition & 1 deletion R/stat-multcomp.R
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ stat_multcomp <- function(mapping = NULL, data = NULL,
method.args = list(),
contrasts = "Tukey",
p.adjust.method = NULL,
small.p = FALSE,
small.p = getOption("ggpmisc.small.p", default = FALSE),
adj.method.tag = 4,
p.digits = 3,
label.type = "bars",
Expand Down
6 changes: 3 additions & 3 deletions R/stat-poly-eq.R
Original file line number Diff line number Diff line change
Expand Up @@ -484,13 +484,13 @@ stat_poly_eq <- function(mapping = NULL, data = NULL,
n.min = 2L,
eq.with.lhs = TRUE,
eq.x.rhs = NULL,
small.r = FALSE,
small.p = FALSE,
small.r = getOption("ggpmisc.small.r", default = FALSE),
small.p = getOption("ggpmisc.small.p", default = FALSE),
CI.brackets = c("[", "]"),
rsquared.conf.level = 0.95,
coef.digits = 3,
coef.keep.zeros = TRUE,
decreasing = FALSE,
decreasing = getOption("ggpmisc.decreasing.poly.eq", FALSE),
rr.digits = 2,
f.digits = 3,
p.digits = 3,
Expand Down
2 changes: 1 addition & 1 deletion R/stat-quant-eq.R
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ stat_quant_eq <- function(mapping = NULL, data = NULL,
eq.x.rhs = NULL,
coef.digits = 3,
coef.keep.zeros = TRUE,
decreasing = FALSE,
decreasing = getOption("ggpmisc.decreasing.poly.eq", FALSE),
rho.digits = 4,
label.x = "left", label.y = "top",
label.x.npc = NULL, label.y.npc = NULL,
Expand Down
4 changes: 2 additions & 2 deletions R/utilities-eq-label.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ build_lhs <- function(output.type = "expression",
#' @export
#'
poly2character <- function (x,
decreasing = FALSE,
decreasing = getOption("ggpmisc.decreasing.poly.eq", FALSE),
digits = 3,
keep.zeros = TRUE) {
if (keep.zeros) {
Expand Down Expand Up @@ -177,7 +177,7 @@ typeset_numbers <- function(eq.char, output.type) {
coefs2poly_eq <- function(coefs,
coef.digits = 3L,
coef.keep.zeros = TRUE,
decreasing = FALSE,
decreasing = getOption("ggpmisc.decreasing.poly.eq", FALSE),
eq.x.rhs = "x",
lhs = "y~`=`~",
output.type = "expression",
Expand Down
16 changes: 8 additions & 8 deletions R/utilities-labels.R
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ bold_label <- function(value,
#' @export
#'
p_value_label <- function(value,
small.p = FALSE,
small.p = getOption("ggpmisc.small.p", default = FALSE),
subscript = "",
superscript = "",
digits = 4,
Expand Down Expand Up @@ -660,7 +660,7 @@ se_value_label <- function(value,
#'
r_label <- function(value,
method = "pearson",
small.r = FALSE,
small.r = getOption("ggpmisc.small.r", default = FALSE),
digits = 3,
fixed = TRUE,
output.type = "expression",
Expand Down Expand Up @@ -725,7 +725,7 @@ r_label <- function(value,
digits, 10^(-digits), decimal.mark = decimal.mark),
sep = "")
} else {
paste(r.symbol, "~`=`~", r.value.char)
paste(r.symbol, "~`=`~", r.value.char, sep = "")
}

} else if (output.type %in% c("latex", "tex", "text", "tikz")) {
Expand All @@ -747,7 +747,7 @@ r_label <- function(value,
digits, 10^(-digits), decimal.mark = decimal.mark),
sep = "")
} else {
paste(r.symbol, " = ", r.value.char)
paste(r.symbol, " = ", r.value.char, sep = "")
}

} else if (output.type == "markdown") {
Expand All @@ -769,7 +769,7 @@ r_label <- function(value,
digits, 10^(-digits), decimal.mark = decimal.mark),
sep = "")
} else {
paste(r.symbol, " = ", r.value.char)
paste(r.symbol, " = ", r.value.char, sep = "")
}

}
Expand All @@ -785,7 +785,7 @@ r_label <- function(value,
#' @export
#'
rr_label <- function(value,
small.r = FALSE,
small.r = getOption("ggpmisc.small.r", default = FALSE),
digits = 3,
fixed = TRUE,
output.type = "expression",
Expand Down Expand Up @@ -866,7 +866,7 @@ rr_label <- function(value,
#' @export
#'
adj_rr_label <- function(value,
small.r = FALSE,
small.r = getOption("ggpmisc.small.r", default = FALSE),
digits = 3,
fixed = TRUE,
output.type = "expression",
Expand Down Expand Up @@ -1022,7 +1022,7 @@ rr_ci_label <- function(value,
#'
r_ci_label <- function(value,
conf.level,
small.r = FALSE,
small.r = getOption("ggpmisc.small.r", default = FALSE),
range.brackets = c("[", "]"),
range.sep = NULL,
digits = 2,
Expand Down
2 changes: 1 addition & 1 deletion man/coefs2poly_eq.Rd

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

10 changes: 5 additions & 5 deletions man/plain_label.Rd

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

7 changes: 6 additions & 1 deletion man/poly2character.Rd

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

4 changes: 2 additions & 2 deletions man/stat_correlation.Rd

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

6 changes: 3 additions & 3 deletions man/stat_ma_eq.Rd

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

2 changes: 1 addition & 1 deletion man/stat_multcomp.Rd

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

6 changes: 3 additions & 3 deletions man/stat_poly_eq.Rd

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

2 changes: 1 addition & 1 deletion man/stat_quant_eq.Rd

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

Loading

0 comments on commit edc7640

Please sign in to comment.