Re: [R] Multiply variable by condition

2012-06-01 Thread Sarah Goslee
On Fri, Jun 1, 2012 at 5:23 PM, David Winsemius wrote: > > On Jun 1, 2012, at 2:37 PM, Sarah Goslee wrote: > >> There are several ways. The easiest to understand is probably using >> if() statements: see ?if for help and examples. >> >> Sarah >> > I would have thought ifelse() to be the necessary

Re: [R] Multiply variable by condition

2012-06-01 Thread David Winsemius
On Jun 1, 2012, at 2:37 PM, Sarah Goslee wrote: There are several ways. The easiest to understand is probably using if() statements: see ?if for help and examples. Sarah I would have thought ifelse() to be the necessary function, but for such simple cases I find boolean math to be clearer.

Re: [R] Multiply variable by condition

2012-06-01 Thread Sarah Goslee
There are several ways. The easiest to understand is probably using if() statements: see ?if for help and examples. Sarah On Fri, Jun 1, 2012 at 11:34 AM, jfca283 wrote: > Hi > I need to do something very simple. I have 2 variables, Y and M. I need to > multiply Y by 1 if M=1, by 2 if M=3 and by

[R] Multiply variable by condition

2012-06-01 Thread jfca283
Hi I need to do something very simple. I have 2 variables, Y and M. I need to multiply Y by 1 if M=1, by 2 if M=3 and by 3.6678 if M=9. How do i make it? Thanks for your time and interest -- View this message in context: http://r.789695.n4.nabble.com/Multiply-variable-by-condition-tp4632086.html