title: How to use conditional statement and return value for a function in R?
body: <p>I have to create a function as: ans(x) which returns the value 2*abs(x), if x is 
  negative, and the value x otherwise. What command could i use? </p>
  
  <p>Thanks  </p>