Skip to content

Start date End date #26

@zx8754

Description

@zx8754

There is already dob, date_stamp, and we could use these to get start and end dates, e.g.:

set.seed(1)
r_data_frame(
  n = 5,
  dob(name = "date_start")) %>% 
  mutate(date_end = date_start + runif(n(), 1, 100))

# # A tibble: 5 x 2
#   date_start date_end  
#   <date>     <date>    
# 1 2007-04-20 2007-06-01
# 2 2007-03-23 2007-06-16
# 3 2008-06-06 2008-07-29
# 4 2007-02-21 2007-04-17
# 5 2008-05-08 2008-07-31

Could we have a dedicated function that would create start and end date, where obviously date_end can't be before the date_start?

Or maybe even better, let date_stamp accept column name for start=, like below:

r_data_frame(
  n = 5,
  dob(name = "date_start")) %>% 
  mutate(date_end = date_stamp(start = date_start))
# Error in seq(start, length = k, by = by) : object 'date_start' not found

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions