[R] Simple if else statement problem

anna_l lippelanna21 at hotmail.com
Mon Nov 16 13:38:44 CET 2009


thanks petr, this is actually shorter ;)

Petr Pikal wrote:
> 
> Hi
> 
> r-help-bounces at r-project.org napsal dne 13.11.2009 18:54:05:
> 
>> 
>> Ok Jim it worked, thank you! it´s funny because it worked with the first
>> syntax in some cases...
> 
> you can use another approach in this case
> 
> P<-max(c(P1,P2))
> 
> Regards
> Petr
> 
> 
>> 
>> 
>> anna_l wrote:
>> > 
>> > Hello, I am getting an error with the following code:
>> > if( P2 > P1)
>> > + {
>> > + P<-P2
>> > + }
>> >> else
>> > Erro: unexpected 'else' in "else"
>> >> {
>> > + P<-P1
>> > + }
>> > 
>> > I checked the syntax so I don´t understand, I have other if else
>> > statements with the same syntax working. Thanks in advance
>> > 
>> 
>> -- 
>> View this message in context: 
> http://old.nabble.com/Simple-if-else-statement-
>> problem-tp26340336p26340642.html
>> Sent from the R help mailing list archive at Nabble.com.
>> 
>> ______________________________________________
>> 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.
> 
> ______________________________________________
> 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.
> 
> 

-- 
View this message in context: http://old.nabble.com/Simple-if-else-statement-problem-tp26340336p26371185.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list