bind_re_match {rematch2}R Documentation

Match results from a data frame column and attach results

Description

Taking a data frame and a column name as input, this function will run re_match and bind the results as new columns to the original table., returning a tibble. This makes it friendly for pipe-oriented programming with magrittr.

Usage

bind_re_match(df, from, ..., keep_match = FALSE)

bind_re_match_(df, from, ..., keep_match = FALSE)

Arguments

df

A data frame.

from

Name of column to use as input for re_match. bind_re_match takes unquoted names, while bind_re_match_ takes quoted names.

...

Arguments (including pattern) to pass to re_match.

keep_match

Should the column .match be included in the results? Defaults to FALSE, to avoid column name collisions in the case that bind_re_match is called multiple times in succession.

Functions

Note

If named capture groups will result in multiple columns with the same column name, repair_names will be called on the resulting table.

See Also

Standard-evaluation version bind_re_match_ that is suitable for programming.

Examples

match_cars <- tibble::rownames_to_column(mtcars)
bind_re_match(match_cars, rowname, "^(?<make>\\w+) ?(?<model>.+)?$")


[Package rematch2 version 2.1.2 Index]