[Rcpp-devel] Over-loading R functions
edd at debian.org
Sat Mar 26 23:38:43 CET 2016
On 26 March 2016 at 21:34, Sparapani, Rodney wrote:
| Hi Gang:
| I was recently explaining to someone that functions like Rcpp::rnorm only
| take scalars. Since the R function takes vectors, the OP was asking me
| I didn¹t have a good answer. This morning, I started thinking about it
| and I realized this could easily be handled by over-loading (I know: that
| why they call me Mr. Excitement ;o)
| I don¹t know if these overloads would have to be written by hand or could
| auto-generated. If the latter, then I guess it is a feature request. If
| then probably a friendly suggestion. But, here is a short example that
| it is feasible if there is any doubt.
| Happy Easter!
Happy Easter to you too. I don't understand your point, I am afraid. If you
think you need an rnorm variant with vector arguments for mean and sd, why
don't you just write one, as you did here, and release it as a package? As I
understand you, this is to solve an apparent issue at the R level, correct?
I really do not see how that __fits into them mission of giving a simple and
useful mechanism__ for access the R RNGs accessible via the R C API. I am
probably missing something here.
In case you want a C(++) level to vector argument mean and sd, you can do
exactly the same but at a different layer. Nobody is stopping you, but as
nobody but you seem to think this is missing in Rcpp nobody but you is likely
to work on it either.
Happy Easter to you too.
http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the Rcpp-devel