Re: R-alpha: ifelse

Peter Dalgaard BSA (pd@kubism.ku.dk)
Tue, 25 Jun 1996 01:00:57 +0200


Date: Tue, 25 Jun 1996 01:00:57 +0200
Message-Id: <199606242300.BAA09692@bush.kubism.ku.dk>
From: Peter Dalgaard BSA <pd@kubism.ku.dk>
To: Robert Gentleman <rgentlem@stat.auckland.ac.nz>
In-Reply-To: Robert Gentleman's message of Tue, 25 Jun 1996 08:57:34 +1200
Subject: Re: R-alpha: ifelse

In article <199606242057.IAA01415@stat.auckland.ac.nz> Robert Gentleman <rgentlem@stat.auckland.ac.nz> writes:


   Jim,
     There is no way that ifelse can be written so that it only evaluates
   one of the last two arguments. If you want that behaviour you need to
   use a for loop over the two vectors.

- or use subset selection, ad modum

c<-x>0; logx[c] <- log(x[c]); logx[!c] <- NA

speaking of which: Would it make sense to define a default restriction
vector? GENSTAT has that facility and it could be kind of useful to
avoid subsetting everything in sight sometimes. Sort of depends on
also having a default vector size, or does it?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk)             FAX: (+45) 35327907
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
r-testers mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: r-testers-request@stat.math.ethz.ch
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-