parse_CI_string: Parse a string with point estimate and confidence interval

Description Usage Arguments Examples

View source: R/functions.R

Description

Given a vector of strings such as "0.65 (0.6, 0.70)", for example obtained by running optical character recognition (OCR) software on a screenshot of a published forest plot, parses the strings into a dataframe of point estimates and upper confidence interval limits. Assumes that the point estimate occurs before an opening bracket of the form "(" or "[" and that the confidence interval upper limit follows a the character sep (by default a comma, but might be a hyphen, for example). To further parse this dataframe into point estimates and variances, see MetaUtility::scrape_meta.

Usage

1
parse_CI_string(string, sep = ",")

Arguments

string

A vector of strings to be parsed.

sep

The character (not including whitespaces) separating the lower from the upper limits.

Examples

1
2
3
4
5
6
7
# messy string of confidence intervals
mystring = c( "0.65 [0.6, 0.7]", "0.8(0.5, 0.9]", "1.2  [0.3, 1.5)")
parse_CI_string(mystring)

# now with a hyphen separator
mystring = c( "0.65 [0.6- 0.7]", "0.8(0.5 - 0.9]", "1.2  [0.3 -1.5)")
parse_CI_string(mystring, sep="-")

MetaUtility documentation built on Oct. 30, 2021, 5:07 p.m.