Closed dax44 closed 6 months ago
Sorry about that. This argument has now been renamed to digits
. If you update to use latest CRAN ggstatsplot (0.12.3
), using digits
should work.
Thanks. I'll check that after merging 0.12.3
0.12.3 is already on CRAN: https://cran.r-project.org/web/packages/ggstatsplot/index.html
Indeed since 0.12.3 digits woks. Thanks
version 0.12.3 ggbetweenstats( ... digits = "signif3" ... ) there is no "round (x, digits)" founction there, what can I do to remove so many unwanted zero? could you help me address this issue? thank you
Can you please provide a reproducible example?
okay, ggs_exp.csv
Rcode: plt <- ggbetweenstats( data = ggs_exp,
type = "np",#non-para digits = "scientific1",#decimal package = "ggsci", palette = "default_jco", ggsignif.args = list(textsize = 6, tip_length = 0.01,family= "Arial"), centrality.label.args = list(size = 6, nudge_x = 0.4, segment.linetype = 4, min.segment.length = 0, y=100), x = x, y = y ) +
labs( x = "Income quintiles", y = expression(paste("Overall income")) )+ theme_bw()+
theme( legend.position = "",
text = element_text(family = "Arial", size = 16, color = "black"),
plot.title = element_text(
family = "Arial", #family = "Lobster Two"
size = 20,
face = "plain",
color = "#2a475e"
),
# Statistical annotations below the main title
plot.subtitle = element_text(
hjust = 0.2,
family = "Arial", #family = "Roboto"
size = 20,
face = "plain",
color="#1b2838"
),
plot.title.position = "plot",
axis.text = element_text(size = 20, color = "black"),
axis.title = element_text(size = 24),
axis.title.y.right = element_text(size = 24)
)+ theme( axis.ticks = element_blank(), axis.line = element_line(colour = "grey50"), panel.grid = element_line(color = "#b4aea9"), panel.grid.minor = element_blank(), panel.grid.major = element_blank() ) plt
I saw a fuction requested by other person in another decimal-related issue report, when the p values within figure are less than 0.001, they can be presented as "< 0.001", if they > 0.001, showing the actual number, whether the following fuction can address the decimal issue
specify_decimal_p <- function(x, k = 3, p.value = FALSE) {
for example, if p.value is 0.002, it should be displayed as such if (k < 3 && isTRUE(p.value)) k <- 3
formatting the output properly output <- trimws(format(round(x = x, digits = k), nsmall = k), which = "both")
if it's a p-value, then format it properly if (isTRUE(p.value) && output < 0.001) output <- "< 0.001"
this will return a character return(output) }
I can't reproduce this behaviour.
Are you sure you have updated all the packages?
Also, are you sure you are not changing digits via options()
somewhere (e.g. .Rprofile
)?
Here is a minimal reproducible example using your data:
library(ggstatsplot)
ggs_exp <- readr::read_csv("/Users/indrajeetpatil/Downloads/ggs_exp.csv")
ggbetweenstats(
x = x,
y = y,
data = ggs_exp,
type = "np",
digits = "scientific1"
)
Created on 2024-04-27 with reprex v2.1.0
SORRY I use this parameter set: digits = "signif3" (you can reproduce via this) rather than digits = "scientific1"
Still same:
library(ggstatsplot)
ggs_exp <- readr::read_csv("/Users/indrajeetpatil/Downloads/ggs_exp.csv")
ggbetweenstats(
x = x,
y = y,
data = ggs_exp,
type = "np",
digits = "signif3"
)
Created on 2024-04-27 with reprex v2.1.0
doesn't matter, the matter thing is how to express the p values without "e" form such as 2.81e-16, just presenting them with solely number, for example, 0.xxx (a actural number when the value > 0.001) or < 0.001(when the value < 0.001), am I clear? can it be achieved?
thank you for your warm feedback and quick response
k
parameter set inggbetweenstats
won't work.gives
Can you help me with number of decimals in central tendency measures?