title: How can I get derivative value in R?
body: <p>I want to get the derivative value from the function below when x = 2. Is there way to keep the form of the function and also get derivative value with out any additional package?</p>
  
  <pre><code>f &lt;- function(x)
    return(x^3)
  </code></pre>
  
  <p>For example, I have tried below but they didn't work.</p>
  
  <pre><code>x=2
  deriv(~f, "x")
  
  x=2
  deriv(~body(f),"x")
  
  x=2
  D(expression(f),"x")
  </code></pre>