Java Mailing List Archive

http://www.r-help.com/

Home » Home (12/2007) » R Help for Statistical Computing »

[R] Puzzled at ifelse()

Ajay Shah

2005-07-12

Replies:

I have a situation where this is fine:

> if (length(x)>15) {
   clever <- rr.ATM(x, maxtrim=7)
  } else {
   clever <- rr.ATM(x)
  }
> clever
$ATM
[1] 1848.929

$sigma
[1] 1.613415

$trim
[1] 0

$lo
[1] 1845.714

$hi
[1] 1852.143

But this variant, using ifelse(), breaks:

> clever <- ifelse(length(x)>15, rr.ATM(x, maxtrim=7), rr.ATM(x))
> clever
[[1]]
[1] 1848.929

What am I doing wrong?

--
Ajay Shah                                  Consultant
ajayshah@(protected)
http://www.mayin.org/ajayshah       Ministry of Finance, New Delhi

______________________________________________
R-help@(protected)
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
©2008 r-help.com - Jax Systems, LLC, U.S.A.