This is working exactly as documented. Nothing `breaks'!
What does the help page say?
'ifelse' returns a value with the same shape as 'test' which is
filled with elements selected from either 'yes' or 'no' depending
on whether the element of 'test' is 'TRUE' or 'FALSE'.
'test'
Ajay Narottam Shah wrote:
> 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] 1
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(),