[R] Vectorise a for loop?
john seers (IFR)
john.seers at bbsrc.ac.uk
Tue Sep 26 15:10:12 CEST 2006
Hi Jacques
Yes, that looks a whole lot better. That "ifelse" is exactly what I was searching for.
Merci.
J
---
John Seers
Institute of Food Research
Norwich Research Park
Colney
Norwich
NR4 7UA
tel +44 (0)1603 251497
fax +44 (0)1603 507723
e-mail john.seers at bbsrc.ac.uk
e-disclaimer at http://www.ifr.ac.uk/edisclaimer/
Web sites:
www.ifr.ac.uk
www.foodandhealthnetwork.com
-----Original Message-----
From: Jacques VESLOT [mailto:jacques.veslot at good.ibl.fr]
Sent: 26 September 2006 14:02
To: john seers (IFR)
Cc: R-help
Subject: Re: [R] Vectorise a for loop?
tt$fold <- ifelse(tt$M < 0, 1/(2^tt$M), 2^tt$M)
-------------------------------------------------------------------
Jacques VESLOT
CNRS UMR 8090
I.B.L (2ème étage)
1 rue du Professeur Calmette
B.P. 245
59019 Lille Cedex
Tel : 33 (0)3.20.87.10.44
Fax : 33 (0)3.20.87.10.31
http://www-good.ibl.fr
More information about the R-help
mailing list