I have a list of double that I want to convert to date of any format possible.
time = seq(2008,2017,length.out = 300)
I cannot use as.Date(time)
directly cause the results will be starting from 1970.
I have a list of double that I want to convert to date of any format possible.
time = seq(2008,2017,length.out = 300)
I cannot use as.Date(time)
directly cause the results will be starting from 1970.
Invert the order: first convert the start and end point to dates, then use seq
to interpolate between them.
Using the ‹lubridate› package:
seq(ymd('2008-01-01'), ymd('2017-01-01'), length.out = 300)
(This is using the first of January as the start and end date; in your code it’s ambiguous what you wanted to use, and indeed one good reason why it can’t work like that.)