Thanks for your reply.
I have already done the same and I am able to run R on Tableau.
However my question was around the fact how do we run user defined functions in Tableau. e.g. I have a code named IRR which contains a function performing certain calculations. I would like to use that function in Tableau. Any ideas on the same would be greatly appreciated.