It is not obvious how to instantiate DateVector and DatetimeVector using Rcpp in C++ code.
Eg. this does not work:
DateVector d = DateVector::create("2010-12-31", "2011-01-01", "2011-05-29");
Currently there is only one article available which mainly focuses on how to work with non-vectorized Dates and Datetimes or using an existing DatetimeVector passed to the example function: https://gallery.rcpp.org/articles/parsing-datetimes/
Request
Add a new article (or modify the existing article) to show examples how to instantiate DateVector and DatetimeVector.
Example code snippets to be included:
// assumes an origin as base for counting the days (risky)
DateVector d = DateVector::create(14974, 14975, 15123);
// uses constructors (shows different ways to create the date elements)
DateVector d = DateVector::create(Date("2010-12-31"), Date("01.01.2011", "%d.%m.%Y"), Date(2011, 05, 29));
Motivation
It is not obvious how to instantiate
DateVector
andDatetimeVector
using Rcpp in C++ code. Eg. this does not work:DateVector d = DateVector::create("2010-12-31", "2011-01-01", "2011-05-29");
Currently there is only one article available which mainly focuses on how to work with non-vectorized
Date
s andDatetime
s or using an existingDatetimeVector
passed to the example function: https://gallery.rcpp.org/articles/parsing-datetimes/Request
Add a new article (or modify the existing article) to show examples how to instantiate
DateVector
andDatetimeVector
.Example code snippets to be included:
References
Rcpp for everyone: Ch 16 - Dates SO question on how to create a new
DateVector
from dates as strings