set_new_row_per_string_item: Create new data.table rows for each combination of first and...

View source: R/set_new_row_per_string_item.R

set_new_row_per_string_itemR Documentation

Create new data.table rows for each combination of first and last name

Description

Create new data.table rows for each combination of first and last name

Usage

set_new_row_per_string_item(
  single_row_dt,
  fname_col,
  lname_col,
  delims = "[-, ]"
)

Arguments

single_row_dt

Data.table with one row/record.

fname_col

First name column name.

lname_col

Last name column name.

delims

Delimters to split string by.

Examples

dt <-
data.table(
  id = c(1, 2),
  fname = c("Aaron David", "Blaine-Myers"),
  lname = c("Schroeder-Dingdong", "Dingbat Tumbleweed"),
  dob = "11/13/1968"
)
final_dt <- dt[, set_new_row_per_string_item(.SD, fname_col = "fname", lname_col = "lname"), id]

uva-bi-sdad/dc.utils documentation built on Aug. 1, 2022, 1:45 a.m.