[R] Help on indicator variables

Göran Broström
Thu, 21 Mar 2013 14:05:25 -0000

On 03/21/2013 02:08 PM, Jorge I Velez wrote:
> Try
>
> ifelse(ABS ==1 | DEFF == 1, 1, 0)

or

as.numeric(ABS | DEFF)

(faster?)

G?ran

>
> HTH,
> Jorge.-
>
>
>
> On Fri, Mar 22, 2013 at 12:02 AM, Tasnuva Tabassum <t.tasnuva at
gmail.com>wrote:
>
>> I have two indicator variables ABS and DEFF. I want to create another
>> indicator variable which will take value 1 if either ABS=1 or DEFF=1.
>> Otherwise, it will take value 0. How can I make that?
>>
>>          [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>