>> I think you could do it a bit more elegantly with
>>
>> gender <- 0.75 + female * 0.5
>>
>> but pmin and pmax are "real" primitives, so I think it's fine to use them.
>
>
> In the folklore ifelse, pmin and pmax are know to be slow.  I know that
> there was some work on pmin and pmax but I think they are still more
> sluggish than desired.

There's certainly lots of micro-optimisations that you could do to
both the R code and the C code, but I think they start to go beyond
what you can expect a reasonably knowledgeable R user to do in
practice. For teaching Rcpp, we have to strike the right balance
between knowledge needed and expected payoff.

Hadley


-- 
RStudio / Rice University
http://had.co.nz/
_______________________________________________
Rcpp-devel mailing list
Rcpp-devel@lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel

Reply via email to