ohh nice!

But still, I don't understand why you consider pmin and pmax as primitives?

Even if they are part of the base package it's not right to consider them
as primitive of the R language!

You can check:
.Primitive('pmax')

It will give you an error!




On Mon, Nov 19, 2012 at 6:36 PM, Hadley Wickham <h.wick...@gmail.com> wrote:
>
> > To be fair with the R language, I would have compare with the use of
real
> > primitives :
> >
> > vaccBubu <- function(age, female, ily) {
> >     gender <- female * 1.25
> >     gender[!female] <- 0.75
> >     p <- (0.25 + 0.3 * 1 / (1 - exp(0.04 * age)) + 0.1 * ily) * gender
> >     p[p < 0] <- 0
> >     p[p > 1] <- 1
> >     p
> > }
> >
>
> 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.
>
> 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