Re: [R] switch with a single character

2008-03-06 Thread Charles C. Berry
On Thu, 6 Mar 2008, Henrik Andersson wrote: > Can anyone explain the results from switch below when a single > charachter "E" is entered? It seems to work with letter S or N... ?switch . . . Warning: Beware of partial matching: an alternative 'E = foo' will match the first argument

[R] switch with a single character

2008-03-06 Thread Henrik Andersson
Can anyone explain the results from switch below when a single charachter "E" is entered? It seems to work with letter S or N... > switch("East",West=1,East=2) # Correct [1] 2 > switch("E",W=1,E=2) # Not so correct [1] 1 > switch("E",E=1,W=2) # Even stranger [1] "E" > switch("S",N=1,S=-1) # Corr