Create waiting days variable
create_waiting_days_var.Rd
Creates a "waiting days" variable by computing the difference between the date the order was created, and the date it was delivered.
Arguments
- df
A dataframe of Delivraide deliveries.
- creat_date
The name of the column representing the order creation date (default: createdAt). Must be in a date or date-time format, not string.
- deliv_date
The name of the column representing the order delivery date (default: updatedAt). Must be in a date or date-time format, not string.
Examples
# Load the sample orders data
data(sample_orders_data)
# Filter delivered orders
delivered_orders <- filter_delivered(sample_orders_data)
# Add waiting days variable
delivered_orders_new <- create_waiting_days_var(delivered_orders)
# You can also use pipes:
delivered_orders_new2 <- delivered_orders |>
create_waiting_days_var()