str_extract_fmt_group {Tplyr} | R Documentation |
Extract format group strings or numbers
Description
These functions allow you to extract segments of information from within a
result string by targetting specific format groups. str_extract_fmt_group()
allows you to pull out the individual format group string, while
str_extract_num()
allows you to pull out that specific numeric result.
Usage
str_extract_fmt_group(string, format_group)
str_extract_num(string, format_group)
Arguments
string |
A string of number results from which to extract format groups |
format_group |
An integer representing format group that should be extracted |
Details
Format groups refer to individual segments of a string. For example, given the string ' 5 (34.4%) [9]', there are three separate format groups, which are ' 5', '(34.4%)', and '[9]'.
Value
A character vector
Examples
string <- c(" 0 (0.0%)", " 8 (9.3%)", "78 (90.7%)")
str_extract_fmt_group(string, 2)
str_extract_num(string, 2)
[Package Tplyr version 1.2.1 Index]