ir object into multiple columns using regular expression groupsExtract a character column in an ir object into multiple columns using regular expression groups
extract.ir(
data,
col,
into,
regex = "([[:alnum:]]+)",
remove = TRUE,
convert = FALSE,
...
)data with an extracted character column. See
tidyr::extract().
An object of class ir.
Column name or position. This is passed to
tidyselect::vars_pull().
This argument is passed by expression and supports quasiquotation (you can unquote column names or column positions).
Names of new variables to create as character vector.
Use NA to omit the variable in the output.
A string representing a regular expression used to extract the
desired values. There should be one group (defined by ()) for each
element of into.
If TRUE, remove input column from output data frame.
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.
Other tidyverse:
arrange.ir(),
distinct.ir(),
filter-joins,
filter.ir(),
group_by,
mutate-joins,
mutate,
nest,
pivot_longer.ir(),
pivot_wider.ir(),
rename,
rowwise.ir(),
select.ir(),
separate.ir(),
separate_rows.ir(),
slice,
summarize,
unite.ir()
## extract
ir_sample_data %>%
tidyr::extract(
id_sample, "a"
)
Run the code above in your browser using DataLab