unite_ci {epikit} | R Documentation |
Unite estimates and confidence intervals
Description
create a character column by combining estimate, lower and upper columns.
This is similar to tidyr::unite()
.
Usage
unite_ci(
x,
col = NULL,
...,
remove = TRUE,
digits = 2,
m100 = TRUE,
percent = FALSE,
ci = FALSE,
separator = "-"
)
merge_ci_df(x, e = 3, l = e + 1, u = e + 2, digits = 2, separator = "-")
merge_pci_df(x, e = 3, l = e + 1, u = e + 2, digits = 2, separator = "-")
Arguments
x |
a data frame with at least three columns defining an estimate, lower bounds, and upper bounds. |
col |
the quoted name of the replacement column to create |
... |
three columns to bind together in the order of Estimate, Lower, and Upper. |
remove |
if |
digits |
the number of digits to retain for the confidence interval. |
m100 |
|
percent |
|
ci |
|
separator |
what to separate lower and upper confidence intervals with, default is "-" |
e |
the column of the estimate (defaults to the third column). Otherwise, a number |
l |
the column of the lower bound (defaults to the fourth column). Otherwise, a number |
u |
the column of the upper bound (defaults to the fifth column), otherwise, a number |
Value
a modified data frame with merged columns or one additional column representing the estimate and confidence interval
Examples
fit <- lm(100/mpg ~ disp + hp + wt + am, data = mtcars)
df <- data.frame(v = names(coef(fit)), e = coef(fit), confint(fit), row.names = NULL)
names(df) <- c("variable", "estimate", "lower", "upper")
print(df)
unite_ci(df, "slope (CI)", estimate, lower, upper, m100 = FALSE, percent = FALSE)