Skip to content
Prev 281259 / 398498 Next

Create variable with AND IF statement

On Jan 2, 2012, at 4:11 AM, Richard Kolodziej wrote:

            
Do you not find the 'ifelse' function described in "An Introduction to  
R" in the section regarding "if".
Not the best answer I have ever seen in the archives. But if you had  
followed up by reading further in the thread you would have found the  
correct approach.
(I think the results of interaction( variable1.fac = 0 , variable2.num  
= 0) should have dome very nicely, but if you wanted them a naked  
numbers then this would have also givne satisfaction:

var3 <- as.numeric( interaction( variable1.fac = 0 , variable2.num =  
0) )