I installed mosaic package available in R to calculate derivative by typing install.packages('mosaic'). I created a function using makeFun and then i tried to calculate derivative in the following way
y1 <- makeFun(a +b *x ~x, a=2, b=2)
dy1.dx <- D(a + b* x ~ x, a=2, b=2)
dy1.dx
but the console shows
" dy1.dx <- D(a+b*x~x, a=2, b=2)
Error in D(a + b * x ~ x, a = 2, b = 2) : unused arguments (a = 2, b = 2)"
How can I correct it?