[R] Assignment working differently inside ifelse()

Stuart Luppescu slu at ccsr.uchicago.edu
Tue Aug 16 20:49:16 CEST 2011


On Tue, 2011-08-16 at 12:10 -0500, Stuart Luppescu wrote:
> but when I use the ifelse() as above, I get this:
>            [,1]       [,2]       [,3]       [,4]
> [1,] 0.04166667 0.04166667 0.04166667 0.04166667
> [2,] 0.00000000 0.00000000 0.00000000 0.00000000

Oh, I see. ifelse() returns a value of the same length as the test
argument. 

-- 
Stuart Luppescu -=- slu .at. ccsr.uchicago.edu        
University of Chicago -=- CCSR 
才文と智奈美の父 -=-    Kernel 2.6.39-gentoo-r3                
This reminds me of a famous FORTRAN code snippet:  
 10 STOP STOP STOP ! IN CASE STILL SKIDDING GOTO 10
 -- Carl Witthoft (in response to the question how 
 to completely stop R       scripts after stop())  
 R-help (January 2011)



More information about the R-help mailing list