Description Usage Arguments Value See Also Examples
Take numeric/character vectors of the estimate, and upper/lower confidence/credible intervals, round with trailing zeros and format into the required journal style.
1 2 3 |
est |
A numeric or character vector of estimates. |
lci |
A numeric or character vector of lower confidence/credible intervals. |
uci |
A numeric or character vector of upper confidence/credible intervals. |
string |
A logicial (defaults to |
sep |
A character vector indicating the seperator used between the upper and lower confidence/credible intervals. The default is ' to '. |
digits |
Integer indicating the number of decimal places to be used. |
inline |
Logical operator indicating whether an explanatory note is required. |
note |
A character vector indicating the explanatory note to be used. |
replace_bracket |
Logical, defaults to |
percentage |
A logical (defaults to |
The estimate with formated upper, and lower confidence/credible intervals as a character vector.
pretty_round pretty_percentage
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Formating a single confidence interval
pretty_ci(2, lci = 1, uci = 3)
## Formating vectors of confidence intervals
est <- c(0, 1, 100, 300, 21221, 403)
lci <- c(-123, -0.2, 50, 100, 12321, 200)
uci <- c(10, 2, 200, 400, 30122, 500)
pretty_ci(est, lci = lci, uci = uci, sep = '-', digits = 1)
## Use in a dplyr workflow
library(dplyr)
x <- data_frame(est = c(0,1), lci = c(0, 2), uci = c(1, 4))
x <- x %>% mutate(ci = est %>% pretty_ci(lci = lci, uci = uci, sep = ' by ', digits = 0))
## Passing values as a single string
est <- c(0, -1, 1)
pretty_ci(est, string = TRUE)
est <- data.frame(est = c(1,2), lci = c(0, 1), uci = c(2, 3))
pretty_ci(est, string = TRUE)
est <- 98
lci <- 96
uci <- 99
pretty_ci(est, lci, uci, percentage = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.