title: How to define a vectorized function in R
body: <p>As the title, I'd like to know how to define a vectorized function in R.</p>
  
  <ul>
  <li>Is it just by using a loop in the function?</li>
  <li>Is this method efficient?</li>
  <li>And what's the best practice ? </li>
  </ul>