[R] partial solutions to: if else statement problem

2010-06-08 Thread Peter Lercher
Thank you to all for your help! I received two equal alternative solutions that bypassed elegantly the problem from peter.l.e.koni...@gmail.com and rafael.bj...@gmail.com rr.dia2.corr <- rr.dia.2m rr.dia2.corr[which(med.hyper == 1)] <- rr.dia.2m[which(med.hyper == 1)] - 5 From pbu...@pburns.sea

[R] problem with if else statement

2010-06-08 Thread Peter Lercher
Dear colleagues, What did I not understand ? ->my intention I want to create a new variable: In plain language: If someone is taking anithypertensive treatment (med.hyper==1) table(med.hyper) med.hyper 0 1 472 97 I want to subtract 5 mmHg (rr.dia.2m-5) from the measured diastolic blood pres