[R] looking for alternative of 'if-else'

Duncan Murdoch murdoch at stats.uwo.ca
Sun Jul 6 12:03:30 CEST 2008


On 06/07/2008 4:59 AM, Arun Kumar Saha wrote:
> There is "if-else" loop if I have to choose 1 item from a 2-item list.
> However if I have a list of 4 items (let say) then how i can choose a single
> item without employing 'if-else' loop? I mean in VBA I can use
> "select-case", is there any equivalent in R as well?

See ?switch.

Duncan Murdoch



More information about the R-help mailing list