thanks petr, this is actually shorter ;)
Petr Pikal wrote:
>
> Hi
>
> r-help-boun...@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<
Hi
r-help-boun...@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 a
ok thanks guys for the help, indeed I assumed there was an explanation thank
you duncan for giving it!
--
View this message in context:
http://old.nabble.com/Simple-if-else-statement-problem-tp26340336p26343665.html
Sent from the R help mailing list archive at Nabble.com.
_
anna_l wrote:
Ok Jim it worked, thank you! it´s funny because it worked with the first
syntax in some cases...
No, it did not. R doesn't randomly work in different
ways on different days.
-Peter Ehlers
anna_l wrote:
Hello, I am getting an error with the following code:
if( P2 > P1)
+ {
On 11/13/2009 12:54 PM, anna_l wrote:
Ok Jim it worked, thank you! it´s funny because it worked with the first
syntax in some cases...
If R knows the whole thing is incomplete, it will accept an else on its
own line. If the first 4 lines make a complete statement, R will
evaluate it, and not
Ok Jim it worked, thank you! it´s funny because it worked with the first
syntax in some cases...
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 synta
Anna,
I think the else needs to be on the same line
as the curly bracket like this "} else".
P1 <- 1
P2 <- 2
if( P2 > P1)
{
P<-P2
} else
{
P<-P1
}
Good luck,
Jim
anna_l wrote:
Hello, I am getting an error with the following code:
if( P2 > P1)
+ {
+ P<-P2
+ }
else
Erro: unexpe
align the else with the curly brackets
if (yes){
be happy
}else{
complain
}
b
On Nov 13, 2009, at 3:33 PM, 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´
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:
9 matches
Mail list logo