# Make R analysis Modules just like MS Excel Templates: Derivative Calculator study case

**CloudStat**, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

In this video tutorial, it will show you how to make R analysis Modules just like MS Excel Templates using the Building Derivative Calculator app as study case.

Let’s say we wanted to know the derivative of tan(x^2 + 3), commonly, we will use the code below to get the result.

e = expression(tan( x^2 + 3 ))

dydx = D(e, “x”)

dydx

Then, when we want to know the derivative of sinh(x^3 – 6), we need to copy the above code, change the expression,

e <- expression(sinh( x^3 - 6 ))

dydx <- D(e, “x”)

dydx

copy the entire code, paste into R GUI again and run to get the result.

What if we can build a R-based statistical module so that our analysis can be reused just like the Excel template?

So, here is a very simple tool to achieve this goal. We just click the “Build” button. We can see our original code. Let’s make some modification.

Substitute the expression, sinh( x^3 – 6 ) into [—||functionx||—] as below

e <- expression( [—||functionx||—] )

dydx <- D(e, “x”)

dydx

At the application area (for designing your user interface), we just copy and paste the [—||functionx||—] there. Then click “Publish” button. The app is gone live immediately!

We just try the newly built R apps by inserting the different expression and execute to get the derivatives. We can make it nicer by hiding the original code.

Demo: http://www.cloudstat.org/index.php?do=/kafechew/blog/derivative-apps/

Hope you will find helpful with this R templates/modules!

**leave a comment**for the author, please follow the link and comment on their blog:

**CloudStat**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.

Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.