title: How to use the switch statement in R functions?
body: <p>I would like to use for my function in R  the statement <code>switch()</code> to trigger different computation according to the value of the function's argument.</p>
  
  <p>For instance, in Matlab you can do that by writing   </p>
  
  <pre><code>switch(AA)        
  case '1'   
  ...   
  case '2'   
  ...   
  case '3'  
  ...  
  end
  </code></pre>
  
  <p>I found this post - <a href="https://stackoverflow.com/questions/7825501/switch-statement-usage">switch() statement usage</a> - that explain how to use <code>switch</code>, but not really helpful to me as I want to perform more sophisticated computation (matrix operations) and not a simple <code>mean</code>.</p>