rdate: Generate random dates

Description Usage Arguments Examples

View source: R/rdate.R

Description

This function provides random date generation with a specified range, that defaults to the beginning and end of the current year.

Usage

1
2
3
4
5
6
rdate(
  n,
  min = paste0(format(Sys.Date(), "%Y"), "-01-01"),
  max = paste0(format(Sys.Date(), "%Y"), "-12-31"),
  ...
)

Arguments

n

number of observations. If length(n) > 1, the length is taken to be the number required.

min, max

lower and upper limits of the distribution. Must be (coercible to) valid dates.

...

parameters given to as.Date() for coercing the values of min and max

Examples

1
2
# generate a million random dates and check the distribution
hist(rdate(1000000), breaks = "months")

cleaner documentation built on June 13, 2021, 5:06 p.m.