[Rcpp-devel] Datetime substraction bug ?

Robin Girard robin.girard at mines-paristech.fr
Tue Apr 2 18:24:27 CEST 2013


It was used in my c++ code :) that's why I had problems héhé. 
R.


----- Mail original -----
De: "Dirk Eddelbuettel" <edd at debian.org>
À: "Robin Girard" <robin.girard at mines-paristech.fr>, "Patrick Burns" <patrick at burns-stat.com>, "Romain Francois" <romain at r-enthusiasts.com>, rcpp-devel at lists.r-forge.r-project.org
Envoyé: Mardi 2 Avril 2013 17:57:07
Objet: Re: [Rcpp-devel] Datetime substraction bug ?


I agree with everybody too :)   

I still like my example, and I obviously respect operator- "in general".

What I can't square is whether the code for operator- (which I may in fact
have defined the way I like it) _actually gets called_.  

In what I sent on March 31 as the NewYear/Easter example:

  R> NewYear <- as.Date("2013-01-01")
  R> Easter <- Sys.Date()
  R> cppFunction('double ddiff(Date a, Date b) { return a - b; }')
  R> cppFunction('double ddiff2(Date a, Date b) { return b - a; }')
  R> ddiff(NewYear, Easter)
  [1] 89                            ## I find this more logical
  R> ddiff2(NewYear, Easter)
  [1] -89                           ## closer to R's difftime and 'odd' to me
  R> 

If it isn't used here, where is it actually used?

Dirk

-- 
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com


More information about the Rcpp-devel mailing list