R commands to do derivatives of a defined function Taking derivatives in R involves using the
eval functions. You wrap the function you want to take the derivative of in expression(), then use D, then eval as follows.
- The first argument passed to eval is the expression you want to evaluate
- the second is a list containing the values of all quantities that are not defined elsewhere.