a <- 1:5
b <- 11:15
c <- 21:25
condChar <- c('d', 'e', 'f', 'd', 'e')
condInt <- c(1, 2, 3, 1, 2)
condFac <- as.factor(condChar)
condMissing <- c(1, NA, 3, NA, 2)
vswitch(x = condChar, d = a, e = b, f = c)
vswitch(x = condInt, a, b, c)
vswitch(x = condFac, d = a, e = b, f = c)
vswitch(x = condMissing, a, b, c)
Run the code above in your browser using DataLab