title: improving syntax in writing functions - multiple default arguments
body: <p>This may be a silly question, I am trying to improve my function writing skills. Let's say I have the following function:</p>
  
  <pre><code>my_fx&lt;- function(my_argument1, my_argument2=c('option1', 'option2')) {
   input_arg&lt;- match.arg(my_argument2)
   if(input_arg=='option1') {
      #feed my_argument1 to internal_function_1
   } else #feed my_argument1 to internal_function_2}
  </code></pre>
  
  <p>I am using <code>match.arg</code> to get a clear error message in case the input does not match allowed arguments, bu I wonder if there is a more direct way to call the right subfunction rather than the if/else statement. Looking forward to receiving your feedback :)</p>