Re: [R] problem with if else statement

2010-06-08 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 08.06.2010 11:46:17: > Hi, > > You are using if/then/else which is a logical control statement and so doesn't > return a value, see > ?if > for details. > > You are probably looking for the ifelse function. Or use possibility of easy conversion logi

Re: [R] problem with if else statement

2010-06-08 Thread Martyn Byng
Hi, You are using if/then/else which is a logical control statement and so doesn't return a value, see ?if for details. You are probably looking for the ifelse function. Martyn -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Pe

Re: [R] problem with if else statement

2010-06-08 Thread Rafael Björk
Hi Peter! The 'if' function operate on a single logical expression, while you provided a vector. What your code does at present is subtract 5 from all values in rr.dia.2m if the first value in med.hyper is 1 and otherwise simply returns all values as is. Since you have no reproducible data, it's h