Usage of the RcppDate
, RcppDatetime
(and their vector
extensions) in C++
is fully defined in Rcpp.h
. As example, consider a call from Rto C++
such as
# 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")
At the C++
level, the corresponding code to assign these parameter to
C++
objects is can be as follows::
SEXP someFunction(SEXP ds, SEXP dts,
SEXP dvs, SEXP dtvs) {
RcppDate d(ds);
RcppDatetime dt(dts);
RcppDateVector dv(dvs);
RcppDatetimeVector dtv(dtvs);
}
Standard accessor functions are defined, see Rcpp.h
for details.
Objects of these types can also be returned via RcppResultSet
.