On Wed, Mar 2, 2011 at 9:36 AM, ivo welch <ivo.we...@gmail.com> wrote:
> thanks, Henrique.  did you mean
>
>    as.vector(t(mapply(function(x, f)f(x), split(t, ((t %% 2)==0)),
> list(f, g))))   ?
>
> otherwise, you get a matrix.
>
> its a good solution, but unfortunately I don't think this can be used
> to redefine ifelse(cond,ift,iff) in a way that is transparent.  the
> ift and iff functions will always be evaluated before the function
> call happens, even with lazy evaluation.  :-(
>
> I still think that it makes sense to have a smarter vectorized %if% in
> a vectorized language like R.  just my 5 cents.
>

Ivo,

There is no guarantee in general that  f(x[3,5,7]) is the same as f(x)[3,5,7]


      -thomas

-- 
Thomas Lumley
Professor of Biostatistics
University of Auckland

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to