From ml-it-r-devel at epigenomics.com  Thu Apr 26 15:53:25 2007
From: ml-it-r-devel at epigenomics.com (ml-it-r-devel at epigenomics.com)
Date: Thu, 26 Apr 2007 15:53:25 +0200
Subject: [Rd] ifelse behaviour
Message-ID: <f0qasl$j79$1@perl.epigenomics.epi>


Hi!

I'm puzzled by the return value of ifelse

consider

x<-integer(0)
ifelse(is(x, "character"), paste(x), x)
[1] NA

whereas
if (is(x, "character")) return(paste(x)) else x
[1] integer(0)

or
x<-integer(1)
ifelse(is(x, "character"), paste(x), x)
[1] 0

work as I had anticipated. Is this correct behaviour?

Regards,

   Matthias


 >sessionInfo()
R version 2.5.0 (2007-04-23)
i686-pc-linux-gnu

locale:
C

attached base packages:
[1] "stats"     "graphics"  "grDevices" "datasets"  "utils"     "methods"
[7] "base"

other attached packages:
rcompletion    rcompgen
     "0.1-2"    "0.1-10"


-- 
Matthias Burger                     Project Manager/ Biostatistician
Epigenomics AG    Kleine Praesidentenstr. 1    10178 Berlin, Germany
phone:+49-30-24345-371                          fax:+49-30-24345-555
http://www.epigenomics.com           matthias.burger at epigenomics.com
--
Epigenomics AG Berlin           Amtsgericht Charlottenburg HRB 75861
Vorstand:   Geert Nygaard (CEO/Vorsitzender),  Dr. Kurt Berlin (CSO)
               Oliver Schacht PhD (CFO),  Christian Piepenbrock (COO)
Aufsichtsrat:   Prof. Dr. Dr. hc. Rolf Krebs (Chairman/Vorsitzender)



[Rd] ifelse behaviour
ml-it-r-devel at epigenomics.com