Skip to content

problem with simple if() statement

7 messages · Norman Goodacre, Alexandre Santos Aguiar, Philippe GROSJEAN +3 more

#
Norman Goodacre wrote:

            
I guess you mean "==" ....

Uwe Ligges
#
Em Seg 06 Fev 2006 04:22, Norman Goodacre escreveu:
I'll guess that it is the use you are making of the name 'seq'. :-)
'seq' is an R function. Try some other name.
#
Norman Goodacre wrote:
Please, read "An Introduction to R" provided with any version of R. The 
correct syntax for an equality condition is "==", not "=", so:

 > if (seq[i] == "A") ....

Best,

Philippe Grosjean
3 days later
#
Hi Norman !
 
I observe that R syntax is very close to C/C++ or Java

--- Philippe Grosjean <phgrosjean at sciviews.org> a
??crit??:
2 days later
#
Evidently, my R has some feature of error messages disabled.
NG> the following code apprantely, for some grand old reason, induces a syntax error:
NG>   if (seq[i] = "A") m <- trans[1,]

NG>   Error: syntax error in "if (seq[i] ="

Where Norman gets this nice error message pointing to the exact
location of the error, all I get is:
Error: syntax error
How do I turn on more-verbose error messages? Is this an environmental
issue, or a build issue?

This is a debian (ubuntu breezy) build; happens even when I run R --vanilla

R.version
         _                
platform i486-pc-linux-gnu
arch     i486             
os       linux-gnu        
system   i486, linux-gnu  
status                    
major    2                
minor    1.1              
year     2005             
month    06               
day      20               
language R                

TIA!
1 day later
#
Patricia J. Hawkins wrote:

            
It's a version issue! Please update.

Uwe Ligges