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 'EXPR' unless that is named. See the examples
for good practice in naming the first argument.
HTH,
Chuck
>
>
>> 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) # Correct
> [1] -1
>
> Kind regards, Henrik
>
> --
> Henrik Andersson
> Tullstorp 2526
> 28195 Vankiva
> Sweden
>
> Tel: +46 451 19149
> Mobil: +46 763 406779
>
> ______________________________________________
> 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.
>
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901