R - Switch

> Procedural Languages > R

Table of Contents

2 - Example

x <- "three";
y <- 0;
switch(x,
       one = {y <- 5},
       two = {y <- 12},
       three = {y <- 432})
y
432
Advertising