Re: [R] Puzzled at ifelse()

2005-07-12 Thread Prof Brian Ripley
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'

Re: [R] Puzzled at ifelse()

2005-07-12 Thread Duncan Murdoch
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

[R] Puzzled at ifelse()

2005-07-12 Thread Ajay Narottam Shah
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(),