sample_date | R Documentation |
sample_date
draws a sample of
n
random dates from a given range.
sample_date(from = "1970-01-01", to = Sys.Date(), size = 1, ...)
from |
Earliest date (as "Date" or string).
Default: |
to |
Latest date (as "Date" or string).
Default: |
size |
Size of date samples to draw.
Default: |
... |
Other arguments.
(Use for specifying |
By default, sample_date
draws n = 1
random date (as a "Date" object) in the range
from = "1970-01-01"
to = Sys.Date()
(current date).
Both from
and to
currently
need to be scalars (i.e., with a length of 1).
A vector of class "Date".
Other sampling functions:
coin()
,
dice_2()
,
dice()
,
sample_char()
,
sample_time()
sample_date()
sort(sample_date(size = 10))
sort(sample_date(from = "2020-02-28", to = "2020-03-01",
size = 10, replace = TRUE)) # 2020 is a leap year
# Note: Oddity with sample():
sort(sample_date(from = "2020-01-01", to = "2020-01-01", size = 10, replace = TRUE)) # range of 0!
# see sample(9:9, size = 10, replace = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.