R - Switch

Card Puncher Data Processing

Example

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







Share this page:
Follow us:
Task Runner