R - use of switch() function

03 Jun 2018

Usage of the switch function

switch("length", "color" = "red", "shape" = "square", "length" = 5)
# [1] 5

switch("color", "color" = "red", "shape" = "square", "length" = 5)
#[1] "red"

[ R  function  ]