caseD <- (variablea == 1)  & (variableb ==1) & (variablec == 1)
with a logical variable.

HTH
Denis Teysseyre

r-sig-epi-request@stat.math.ethz.ch a écrit :
> Send R-sig-Epi mailing list submissions to
> 	r-sig-epi@stat.math.ethz.ch
>
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://stat.ethz.ch/mailman/listinfo/r-sig-epi
> or, via email, send a message with subject or body 'help' to
> 	r-sig-epi-request@stat.math.ethz.ch
>
> You can reach the person managing the list at
> 	r-sig-epi-owner@stat.math.ethz.ch
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of R-sig-Epi digest..."
>
>
> Today's Topics:
>
>    1. question re: recoding in R (Lynn Disney)
>    2. Re: question re: recoding in R (Alexandre Aguiar)
>    3. Re: question re: recoding in R (griera@gmail.com)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 25 Jul 2007 15:34:53 -0400
> From: "Lynn Disney" <ldisney@seiu1199.org>
> Subject: [R-sig-Epi] question re: recoding in R
> To: <r-sig-epi@stat.math.ethz.ch>
> Message-ID:
> 	<1B80C974ABFB23429A403B6667FE84C7B0EAAA@seiumain.SEIU.local>
> Content-Type: text/plain
>
> I need to create dummy variables, for an ID when 3 conditions exist. I
> am having problems figuring out how to do this. For example, I want
> variablea=1 and variableb=1 and variablec=1 and then have variableD
> turned into a 1 when these conditions are true and 0 when any one of
> them are false. 
>
>  
>
> Suggestions?
>
>  
>
> Lynn D. Disney, Ph.D., J.D., M.P.H.
>
>  
>
>
> 	[[alternative HTML version deleted]]
>
>
>
> ------------------------------
>
> Message: 2
> Date: Wed, 25 Jul 2007 18:37:01 -0300
> From: Alexandre Aguiar <asaguiar@spsconsultoria.com>
> Subject: Re: [R-sig-Epi] question re: recoding in R
> To: r-sig-epi@stat.math.ethz.ch
> Message-ID: <200707251837.02125@spsconsultoria.com>
> Content-Type: text/plain;  charset="iso-8859-1"
>
> Em Qua 25 Jul 2007, Lynn Disney escreveu:
>   
>> I need to create dummy variables, for an ID when 3 conditions exist. I
>> am having problems figuring out how to do this. For example, I want
>> variablea=1 and variableb=1 hand variablec=1 and then have variableD
>> turned into a 1 when these conditions are true and 0 when any one of
>> them are false.
>>     
>
> Ooops! This one even I know.
>
> d <- 0
> if( a & b & c ) d <- 1
>
> Depending on the expected proportions of d==1 and d==0 and how many tests you 
> are going to do, starting with d <- 1 and then testing for !( a & b & c ) 
> could be faster. However, the code above should be good enough in 99.9% of 
> applications.
>
> Maybe you would like to check out [http://finzi.psych.upenn.edu/nmz.html]. It 
> has answsered 100% of my questions so far.
>
> Best wishes.
>
> Alexandre
>
>   

-- 
denis.teysseyre@gmail.com


	[[alternative HTML version deleted]]

