[Rcpp-devel] times, dates, etc .... in the new apis

Romain Francois francoisromain at free.fr
Tue Jan 26 20:25:37 CET 2010


What about something like :

class Rcpp::Date similar to RcppDate.

and :

as<Date>(SEXP)
as<vector<Date>>(SEXP)
wrap<Date>(const Date& date)
wrap<vector<Date>>(const vector<Date>& date)

and maybe perhaps also:

as<time_t>(SEXP)
as<vector<time_t>>(SEXP)
wrap<time_t>( const time_t& t)
wrap<vector<time_t>>( const vector<time_t>& t)

We probably not need additional Rcpp:: classes (apart maybe from Date) 
here, so that all the wrap versions above could return a NumericVector 
but setting the attributes differently.

... actually now that I think of it, for Date we should just have to 
create:
- operator SEXP()
- Date(SEXP)

in order to get as and wrap for free (could be a good example for what 
the NEWS pretends.

Romain

-- 
Romain Francois
Professional R Enthusiast
+33(0) 6 28 91 30 30
http://romainfrancois.blog.free.fr
|- http://tr.im/KfKn : Rcpp 0.7.2
|- http://tr.im/JOlc : External pointers with Rcpp
`- http://tr.im/JFqa : R Journal, Volume 1/2, December 2009



More information about the Rcpp-devel mailing list