parens-extractors {scrutiny} | R Documentation |
Extract substrings from before and inside parentheses
Description
before_parens()
and inside_parens()
extract substrings from
before or inside parentheses, or similar separators like brackets or curly
braces.
See split_by_parens()
to split some or all columns in a data frame into
both parts.
Usage
before_parens(string, sep = "parens")
inside_parens(string, sep = "parens")
Arguments
string |
Vector of strings with parentheses or similar. |
sep |
String. What to split by. Either |
Value
String vector of the same length as string
. The part of string
before or inside sep
, respectively.
Examples
x <- c(
"3.72 (0.95)",
"5.86 (2.75)",
"3.06 (6.48)"
)
before_parens(string = x)
inside_parens(string = x)
[Package scrutiny version 0.4.0 Index]