[R] Is this a bug?
Luca Braglia
lbraglia at gmail.com
Tue Apr 17 20:47:39 CEST 2007
I have found a strange "ifelse" behaviour (I think)
This works:
> ifelse(T,1+1,1+2)
[1] 2
> ifelse(F,1+1,1+2)
[1] 3
Maybe I missed something about R internals, but why
> ifelse(T,print("hello"),print("goodbye"))
[1] "hello"
[1] "hello"
> ifelse(F,print("hello"),print("goodbye"))
[1] "goodbye"
[1] "goodbye"
values are returned two times? I'm not sure: if it's a bug I'll post it
immediately
Thank You
Luca
Version:
platform = i486-pc-linux-gnu
arch = i486
os = linux-gnu
system = i486, linux-gnu
status =
major = 2
minor = 4.1
year = 2006
month = 12
day = 18
svn rev = 40228
language = R
version.string = R version 2.4.1 (2006-12-18)
Locale:
LC_CTYPE=it_IT.UTF-8;LC_NUMERIC=C;LC_TIME=it_IT.UTF-8;LC_COLLATE=it_IT.UTF-8;LC_MONETARY=it_IT.UTF-8;LC_MESSAGES=it_IT.UTF-8;LC_PAPER=it_IT.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=it_IT.UTF-8;LC_IDENTIFICATION=C
Search Path:
.GlobalEnv, package:MASS, package:utils, package:stats, package:graphics, package:grDevices, package:methods, Autoloads, package:base
More information about the R-help
mailing list