Learn R Programming

dataMojo (version 1.0.0)

row_expand_dates: Expand row given start and end dates

Description

Expand row given start and end dates

Usage

row_expand_dates(dt, start_date_col, end_date_col, new_name)

Value

expanded data table

Arguments

dt

input data table

start_date_col

start date column

end_date_col

end date column

new_name

new generated column name

Examples

Run this code
dt_dates_simple <- data.table::data.table(
  Start_Date = as.Date(c("2020-02-03", "2020-03-01") ),
  End_Date = as.Date(c("2020-02-05", "2020-03-02") ),
  group = c("A", "B")
)
row_expand_dates(dt_dates_simple, "Start_Date", "End_Date", "Date")[]

Run the code above in your browser using DataLab