R - Switch

Card Puncher Data Processing

Example

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





Discover More
Card Puncher Data Processing
R - Flow (Control Structure)

See The Control structures are primarily useful for writing programs. In the console, the apply functions (apply, sapply, ..) are most appropriated. if: testing a condition for: execute a loop n...



Share this page:
Follow us:
Task Runner