Re: [R] vectorising ifelse()

From: Federico Calboli <f.calboli_at_imperial.ac.uk>
Date: Sat 23 Jul 2005 - 07:57:10 EST


On 22 Jul 2005, at 11:20, Adaikalavan Ramasamy wrote:

> Does either 'zippo' or 'zappo' contain the values 1 or 2 ?
>
>
> If so, then you cannot vectorize this code because you are changing
> the
> values in 'new' at every iteration and potentially sampling a value
> from
> new[ ,1] or new[ ,2] .
>

That's exactly my situation, and is exactly what I want to do.

After taking out the typo (and bug) "drow[i]>0" the code seems to work fast enough... I'll tinker a bit with it, but it could be good enough as it is.

Cheers,

Federico Calboli

--
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG

Tel +44 (0)20 75941602   Fax +44 (0)20 75943193

f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Sat Jul 23 08:03:14 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:33:57 EST