[R] Switch and integer

Knut Krueger Knut-krueger at einthal.de
Mon Dec 11 13:33:59 CET 2006


David Barron schrieb:
>
> If the value of EXPR is an integer between 1 and nargs()-1 then the
> corresponding element of ... is evaluated and the result returned.
>
Thank you, I wondered about the
> integer between 1 and nargs()-1
and the example from the help file for(i in c(-1:3,9))  print(switch(i,
1,2,3,4))
No see I  that the 1,2,3,4 is the output not the value, but it's not
very clear for me ho it works.
I will try to find it out ...
The switch for Integer is very different from C++ or Pascal .. maybe
this was the reason for the problem.

Regards Knut




More information about the R-help mailing list