Date.function: Date Related Functions

random.DateR Documentation

Date Related Functions

Description

random.Date() is a function that randomly creates a vector of dates at a specified sample size between a specified date and a date.

age.cal() is a function that calculates the number of years (age by default), months, and days from a specified date to a specified date.

Usage

random.Date(
  from,
  to = Sys.Date(),
  size,
  replace = FALSE,
  prob = NULL,
  by = "day"
)

age.cal(from, to = Sys.Date(), by = "year")

Arguments

from

starting date. Required.

to

end date.Optional. Optional. Default is today (sys.Date()).

size

a non-negative integer giving the number of items to choose.

replace

should sampling be with replacement?

prob

a vector of probability weights for obtaining the elements of the vector being sampled.

by

increment of the sequence.

Value

A vector of class "Date".

See Also

Date, seq.Date, sample


indenkun/infun documentation built on April 17, 2025, 2:52 p.m.