[R] Odp: partial solutions to: if else statement problem

Petr PIKAL petr.pikal at precheza.cz
Tue Jun 8 14:38:33 CEST 2010


Hi

r-help-bounces at r-project.org napsal dne 08.06.2010 14:21:10:

> Thank you to all for your help!
> 
> I received
> two equal alternative solutions that bypassed elegantly the problem
> from peter.l.e.konings at gmail.com
> and
> rafael.bjork at gmail.com
> 
> rr.dia2.corr <- rr.dia.2m
> rr.dia2.corr[which(med.hyper == 1)] <- rr.dia.2m[which(med.hyper == 1)] 
- 5

Try to compare it with my suggestion

my.result <- rr.dia.2m - (med.hyper == 1)*5
all.eqal(rr.dia2.corr, my.result)

which by my opinion will be same.

Regards
Petr


> 
>  From pburns at pburns.seanet.com
> I received a hint to understand the problem why my code does not work.
> p 13 on
> http://lib.stat.cmu.edu/S/Spoetry/Tutor/R_inferno.pdf
> 
> I have to digest this yet
> 
> Peter
> 
> 
> ______________________________________________
> 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.



More information about the R-help mailing list