extract.ir: Extract a character column in an 'ir' object into multiple...

View source: R/tidyverse.R

extract.irR Documentation

Extract a character column in an ir object into multiple columns using regular expression groups

Description

Extract a character column in an ir object into multiple columns using regular expression groups

Usage

extract.ir(
  data,
  col,
  into,
  regex = "([[:alnum:]]+)",
  remove = TRUE,
  convert = FALSE,
  ...
)

Arguments

data

An object of class ir.

col

<tidy-select> Column to expand.

into

Names of new variables to create as character vector. Use NA to omit the variable in the output.

regex

A string representing a regular expression used to extract the desired values. There should be one group (defined by ⁠()⁠) for each element of into.

remove

If TRUE, remove input column from output data frame.

convert

If TRUE, will run type.convert() with as.is = TRUE on new columns. This is useful if the component columns are integer, numeric or logical.

NB: this will cause string "NA"s to be converted to NAs.

...

Additional arguments passed on to methods.

Value

data with an extracted character column. See tidyr::extract().

Source

tidyr::extract()

See Also

Other tidyverse: arrange.ir(), distinct.ir(), filter-joins, filter.ir(), group_by, mutate, mutate-joins, nest, pivot_longer.ir(), pivot_wider.ir(), rename, rowwise.ir(), select.ir(), separate.ir(), separate_rows.ir(), slice, summarize, unite.ir()

Examples

## extract
ir_sample_data |>
  tidyr::extract(
    id_sample,  "a"
  )



henningte/ir documentation built on July 4, 2025, 5:12 p.m.