[R] Dummy (factor) based on a pair of variables
Bernardo Rangel Tura
tura at centroin.com.br
Sat Apr 18 11:31:42 CEST 2009
On Sat, 2009-04-18 at 08:55 +0200, Serguei Kaniovski wrote:
>
> Dear All!
>
> my data is on pairs of countries, i and j, e.g.:
>
> y,i,j
> 1,AUT,BEL
> 2,AUT,GER
> 3,BEL,GER
>
> I would like to create a dummy (indicator) variable for use in regression
> (using factor?), such that it takes the value of 1 if the country is in the
> pair (i.e. EITHER an i-country OR an j-country).
>
> Thank you for your help,
> Serguei
Hi Serguei,
If I understand your doubt, the solution is something like this for pair
i-country is AUT or j-country is BEL
output ~ I(i-country=="AUT"|j-country=="BEL")
--
Bernardo Rangel Tura, M.D,MPH,Ph.D
National Institute of Cardiology
Brazil
More information about the R-help
mailing list