Generating Random Dates

date, r

Solution

`seq` has a method for class `Date` which works for this:

sample(seq(as.Date('1999/01/01'), as.Date('2000/01/01'), by="day"), 12)

Problem

How can I generate a set of 12 random dates within a specific date range? I thought the following would work: ``` sample(as.Date(1999/01/01), as.Date(2000/01/01),12) ``` But the result looks like a random set of numbers? Thank you

Original source