I am familiar with coding dummy variables in this way to use in regression analysis (example is from coding for region in panel data)
dum1<-ifelse(var=="condition",1,0)
What Iām wondering is why when I attempt to code it this way
if(variable=="condition"){dum1<-1} else {dum1<-0}
I get this:
Warning message: In if (variable == "condition") { : the condition has length > 1 and only the first element will be used
Can someone help explain this to me? Thanks