Finds the date corresponding a row index of a matrix given the date (origin) of the first row

findDate(
  k,
  origin = "1961-1-1",
  data.frame = TRUE,
  decimal = FALSE,
  character = FALSE
)

Arguments

k

integer or decimal value corresponding to number of days since origin

origin

origin date. See also extractdays

data.frame

logical variable. If TRUE (default) the date is returned as data frame (like data in extractyears), otherwise it is returned as character or POSIXct.

decimal

logical variable. If FALSE (default) k is integer and starts from 1, otherwise is consider as the decimal julian day since origin (deprecated)

character

logical variable. It is used if data.frame is FALSE, if it is FALSE, the date is returned as POSIXct, otherwise it is a character in the following form: YYYY-MM-DD

Value

the date(s) corresponding to k under different formats

Note

It uses functions of time package. It works like an inverse functions of extractdays. If k is a vector, the function returns several dates for each element of k

Examples

findDate <- findDate(100,origin="1961-1-1",data.frame=FALSE,character=TRUE)