I'd like to utilise the switch() statement in R for my function to trigger different computations depending on the value of the function's input.
In Matlab, for example, you may achieve this by writing
switch(AA)
1st case
...
2nd case
...
'3' case
...
end
I found this post - switch() statement usage - that explains how to use switch, but it's not really helpful for me because I want to do more complex calculations (matrix operations) rather than a basic mean.