**CloudStat**, and kindly contributed to R-bloggers)

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 his blog:

**CloudStat**.

R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...