I was trying to create a function to derive an expression and the command gives the error below. Can anybody help me ?
derivada<- function(x){
expression(x)
z <- D(x,"x")
print(z)
}
derivada(x^2)
Error in D(x, "x") : object 'x' not found