A function to convert effect estimates into percentage changes for use in line in publications. It can either convert an effect estimate with lower and upper confidence intervals that is unformated into a pretty formated percentage or it can convert a pretty_ci formatted effect size into a pretty formated percentage.

pretty_per_effect(est = NULL, lci = NULL, uci = NULL, string = FALSE,
sep = " to ", note = "95% CI ", replace_bracket = TRUE, digits = 0,
inline = FALSE, percentage = TRUE, effect_direct = "increase", ...)

## Arguments

est A numeric or character vector of estimates. A numeric or character vector of lower confidence/credible intervals. A numeric or character vector of upper confidence/credible intervals. Logical, defaults to FALSE. Is the input a string as formated by pretty_ci? If TRUE Then this function is not vectorised. Will attempt to split based on the supplied sep criteria as well as several common splitting characters. A character vector indicating the seperator used between the upper and lower confidence/credible intervals. The default is ' to '. A character vector indicating the explanatory note to be used. Logical, defaults to TRUE. Should the leading bracket be automatically be reinserted in front of the custom note supplied by note. Integer indicating the number of decimal places to be used. Logical operator indicating whether an explanatory note is required. A logical (defaults to FALSE), which indicates whether the output should be treated as a percentage. A character string indicating the direction of the percentage. Can be specified as "increase" or "decrease" (defaults to "increase"). Pass additional arguements to pretty_ci

## Value

A pretty formated percentage with confidence intervals

pretty_ci

## Examples


est <- 1.2
lci <- 1.1
uci <- 1.3

## As unformated effects
pretty_per_effect(est, lci, uci)#>  "20% (10% to 30%)"
## As formated effects

x <- pretty_ci(est, lci, uci, inline = TRUE)
pretty_per_effect(x, string = TRUE, inline = TRUE)#>  "20% (95% CI 10% to 30%)"
## For a decrease
pretty_per_effect(x, string = TRUE, inline = TRUE, effect_direct = "decrease")#>  "-20% (95% CI -30% to -10%)"
## For difference seperations between strings (vectorised)
x <- pretty_ci(est, lci, uci, inline = TRUE, sep = ", ")
x <- c(x, x)

pretty_per_effect(x, string = TRUE, inline = TRUE)#>  "20% (95% CI 10% to 30%)" "20% (95% CI 10% to 30%)"
## For a decrease
pretty_per_effect(x, string = TRUE, inline = TRUE, effect_direct = "decrease")#>  "-20% (95% CI -20% to -30%)"
## Vectorised (as a string)
est <- c(est, 1.1)
lci <- c(lci, 1)
uci <- c(uci, 1.2)

pretty_per_effect(est, lci, uci)#>  "20% (10% to 30%)" "10% (0% to 20%)"