[Rd] ifelse behaviour

ml-it-r-devel at epigenomics.com ml-it-r-devel at epigenomics.com
Thu Apr 26 15:53:25 CEST 2007


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)



More information about the R-devel mailing list