diff --git a/DESCRIPTION b/DESCRIPTION index 0fe0707..fb235f8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: emmeans Type: Package Title: Estimated Marginal Means, aka Least-Squares Means -Version: 1.10.4.900003 -Date: 2024-10-02 +Version: 1.10.5 +Date: 2024-10-14 Authors@R: c(person("Russell V.", "Lenth", role = c("aut", "cre", "cph"), email = "russell-lenth@uiowa.edu"), person("Balazs", "Banfai", role = "ctb"), diff --git a/NEWS.md b/NEWS.md index 2c96c45..4747839 100644 --- a/NEWS.md +++ b/NEWS.md @@ -7,6 +7,7 @@ title: "NEWS for the emmeans package" * Fix for inconsistent contrasts in case of missing levels (#508, #509) * Fix for using nuisance variables with proportional weights (#510) * New function `with_emm_options()` to run code with options temporarily set + * Tweak to optimal-digits output that shows `SE` to 3 significant digits diff --git a/R/summary.R b/R/summary.R index b63dedf..c9b70d2 100644 --- a/R/summary.R +++ b/R/summary.R @@ -1360,6 +1360,8 @@ print.summary_emm = function(x, ..., digits=NULL, quote=FALSE, right=TRUE, expor est = x[[estn]] if (get_emm_option("opt.digits") && is.null(digits)) { + if (!is.null(x$SE)) + x$SE = signif(x$SE, 3) if (!is.null(x[["SE"]])) tmp = est + x[["SE"]] * cbind(rep(-2, nrow(x)), 0, 2) else if (!is.null(x[["lower.HPD"]])) diff --git a/README.md b/README.md index b0dbe23..f6e3331 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,13 @@ They can always be found [for the latest CRAN version](https://cran.r-project.or For the latest release notes on this development version, see the [NEWS file](https://github.com/rvlenth/emmeans/blob/master/NEWS.md) +## Rounding +For its summary output, **emmeans** uses an optimal-digits algorithm that rounds +results to about the number of digits that are useful, relative to estimates' +confidence limits. This avoids cluttering the output, but it is unlike other R +results, which are typically less round. If this is annoying to you, there is an +option (`opt.digits = FALSE`) that disables the optimal-digits routine. + ## "Tidiness" can be dangerous I see more and more users who are in a terrible hurry to get results. They develop a "workflow" where they plan-out several steps at once and pipe them diff --git a/man/emm_options.Rd b/man/emm_options.Rd index 5d8cf45..72da87a 100644 --- a/man/emm_options.Rd +++ b/man/emm_options.Rd @@ -42,7 +42,7 @@ on reproducible bugs. When \code{disable} is specified, the other arguments are or its default value if not found. \code{with_emm_options()} temporarily sets the options in \code{...}, then - evaluates \code{expr} and returns the result. + evaluates \code{try(expr)} and returns the result. } \description{ Use \code{emm_options} to set or change various options that are used in diff --git a/vignettes/FAQs.Rmd b/vignettes/FAQs.Rmd index 5711f6c..564594f 100644 --- a/vignettes/FAQs.Rmd +++ b/vignettes/FAQs.Rmd @@ -39,6 +39,8 @@ This vignette contains answers to questions received from users or posted on dis 12. [I asked for a Tukey adjustments, but that's not what I got](#notukey) 12. [`emmeans()` completely ignores my P-value adjustments](#noadjust) 13. [`emmeans()` gives me pooled *t* tests, but I expected Welch's *t*](#nowelch) + 14. [I want to see more digits](#rounding) + [Index of all vignette topics](vignette-topics.html) @@ -419,5 +421,12 @@ you will obtain incorrect results. Get the model right *first*. [Back to Contents](#contents) +## I want to see more digits {#rounding} +The summary display of `emmeans()` and other functions uses an optimal-digits +routine that shows only relevant digits. If you temporarily want to see more +digits, add `|> as.data.frame()` to the code line. In addition, piping +`|> data.frame()` will disable formatting of test statistics and P values (but +unfortunately will also suppress messages below the tabular output). + [Index of all vignette topics](vignette-topics.html)