Skip to content
Prev 177509 / 398503 Next

Dummy (factor) based on a pair of variables

On 2009.04.18 15:58:30, Jason Morgan wrote:
Oops, I apologize for not reading the whole question. Can you do the
following:

lm(y ~ I(ifelse(df$i=="AUT"|df$j=="AUT", 1, 0)) +
       I(ifelse(df$i=="BEL"|df$j=="BEL", 1, 0)) +
       I(ifelse(df$i=="GER"|df$j=="GER", 1, 0)), data=df)

If you exclude the ifelse(), you will get a vector of TRUE/FALSE,
which may or may not work.

~Jason
--
Jason W. Morgan
Graduate Student, Political Science
*The Ohio State University*