Split estimate and confidence intervals into columns

This function takes a column of text-formatted estimates and confidence intervals (e.g. `"2.1 (1.1, 3.2)"`) and splits it into numeric columns: `est`, `lower`, and `upper`.

x_ci_split(dat, var)

Arguments

dat

A data frame containing the variable to be split.

var

The unquoted name of the variable containing estimate and CI strings.

Value

A data frame with three new numeric columns: `est`, `lower`, and `upper`.

Examples

df <- data.frame(ci_text = c("2.1 (1.1, 3.2)", "0.5 (-0.1, 1.2)", "1.0 (0.8, 1.3)"))
x_ci_split(df, ci_text)
#> # A tibble: 3 × 3
#>     est lower upper
#>   <dbl> <dbl> <dbl>
#> 1   2.1   1.1   3.2
#> 2   0.5  -0.1   1.2
#> 3   1     0.8   1.3