Hello all,
I am trying to pass from C++ to R a DateVector with a few missing items (NAs).
I can't seem to find a way, though.
There does not seem to be a NA_DATE (like NA_REAL, etc), and the default
constructor for Rcpp::Date creates a date of "-5877641-06-23".
I have even tried to pass an Rcpp::NumericVector and convert like this:
Rcpp::NumericVector a = Rcpp::NumericVector::create(3883, NA_REAL, 15120);
Rcpp::Language call("as.Date", a, Rcpp::Named("origin", "1970-1-1"));
Rcpp::DateVector b(3);
aa = call.eval();
but I still get "1980-08-19" "-5877641-06-23" "2011-05-26" .
The only way to get the expected output is by:
Rcpp::NumericVector a = Rcpp::NumericVector::create(3883, NA_REAL, 15120);
R["a"] = a;
R.parseEvalQ("aaa <- as.Date(a, origin=\"1970-1-1\")");
Isn't there any better way to specify a NA for dates, or check if an
Rcpp::Date is NA ??
Thank you in advance,
Theodore Lytras
_______________________________________________
Rcpp-devel mailing list
[email protected]
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel