R Switch
switch picks by name or number. Add a final unnamed value as default.
Example
day <- "Wed"
print(switch(day, Mon = "Start", Wed = "Middle", Fri = "End", "Other"))Exercise
Make 2 the default value.
switch(x, a = 1, )
Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.