In R, is there a way to make a switch statement such that the same block of code is executed for two different cases? Obviously I could copy and paste the whole body of code for both statements, but I was hoping there would be a neater way to do it.
I could also use an if-else block to avoid the repetition of large blocks of code but switches are generally faster in R.
It seems unlikely due to the way R parses a switch statement as a function, but I'm hoping that the developers of R took special care in parsing a switch statement to allow for multiple arguments to refer to the same block of code.