A Simple and Flexible Switch-Case Construct for the 'R' Language

Provides a switch-case construct for 'R', as it is known from other programming languages. It allows to test multiple, similar conditions in an efficient, easy-to-read manner, so nested if-else constructs can be avoided. The switch-case construct is designed as an 'R' function that allows to return values depending on which condition is met and lets the programmer flexibly decide whether or not to leave the switch-case construct after a case block has been executed.


Package 'switchcase'

A simple yet flexible switch-case construct for R. Function switchCase() provides the actual switch-case functionality. The alt() function is used to formulate alternative 'case' branches of the switch-case construct.

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("switchcase")

0.1.1 by Joachim Zuckarelli, 6 years ago


https://github.com/jsugarelli/switchcase/


Report a bug at https://github.com/jsugarelli/switchcase/issues


Browse source code at https://github.com/cran/switchcase


Authors: Joachim Zuckarelli [aut, cre]


Documentation:   PDF Manual  


GPL-3 license



See at CRAN