RcppDatetimeVector are C++ classes defined in their respective
headers files. They are part of the 'classic' Rcpp API. These classes
pass scalars and vectors of R objects of types
POSIXct, respectively, to C++ via the
Member functions are provided to query the dimension of the vector or
matrix object, convert it in a corresponding
R objects of type
Date, and hence the
RcppDateVector objects, are internally represented as an
integer counting days since the epoch, i.e. January 1,
1970. Similarly, R objects of type
POSIXct and the
RcppDatetimeVector objects, are
internally represented as seconds since the epoch. However, R
extends the POSIX standard by using a double leading to microsecond
precision in timestamps. This is fully supported by
The new API currently has the classes
Rcpp::DatetimeVector which are preferred
for new developments, as is the rest of the new API in the Rcpp package
while the RcppClassic package has been deprecated since
Usage of the
RcppDatetime (and their vector
C++ is fully defined in the respective header
As example, consider a call from R to
C++ such as
1 2 3 4 5 6 7 8 9 10 11
# an R example passing one type of each class to a function # someFunction in package somePackage val <- .Call("someFunction", Sys.Date(), # current date Sys.time(), # current timestamp as.Date("2000-02-25") + 0:5, # date vector ISOdatetime(1999,12,31,23,59,0) + (0:5)*0.250, # datetime vector PACKAGE="somePackage")
C++ level, the corresponding code to assign these parameter to
C++ objects is can be as follows::
1 2 3 4 5 6 7 8 9
Standard accessor functions are defined, see
RcppDatetime.h for details.
Objects of these types can also be returned via
Dominick Samperi wrote the initial versions of Rcpp (and RcppTemplate) during 2005 and 2006. Dirk Eddelbuettel made some additions, and became maintainer in 2008. Dirk Eddelbuettel and Romain Francois have been extending Rcpp since 2009.
Writing R Extensions, available at https://www.r-project.org.
See the RcppExamples-package for examples of the recommended Rcpp API and Rcpp-package for documentation on the recommended API to extend R with C++ code, while the deprecated RcppClassic-package documents the older, deprecated API.
1 2 3 4 5 6 7 8 9
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.