R studio for accounting?

Hi I'm new to R and have been researching whether or not RStudio (and R more generally) are good tools to run a private company's accounting and financial reporting and modeling functions. I haven't had much luck thus far finding tutorials or packages that support these tasks. Any help/thoughts/suggestions would be greatly appreciated!


1 Like

Hi Ryan,

I can't speak to accounting in particular, but I do know there are a number of packages focused on time series analysis and forecasting. And in general, R is a great choice for custom reporting and modeling. The CRAN Task View on time series analysis may be a good place to start:

There have also been some recent threads here which might be relevant to the modeling questions:


Ryan, can you give any specific examples of what you want to get out of the accounting reporting and modeling? I imagine that R can handle it, and can imagine a number of workflows like:

Database -> R (modeling + general data munging) -> R Shiny (reporting / dashboard)

The tidyverse is a great platform for the type of data manipulation that you might do in Excel, i.e. adding multiple columns onto your data.frame that depended on other previous columns, then summarizing that data somehow. Shiny then gives you the tools to show off the results in a nice and potentially interactive way.


RStudio is excellent for analysis, including financial analysis, where you have a highly trained researcher tackling a not well defined problem - but a poor fit for general bookkeeping, where you want to follow a set of simple input tasks (following hard coded arcane rules).

Other tools are better suited for that. If you absolutely need to avoid a special bookkeeping software do consider *gasp* MS Excel. At least you will find help online, as the finance people are some of the most die hard Excel fans.


Thanks so much for your feedback Matt, Davis and Jindra, it is much appreciated. I did find a package called Finstr (https://github.com/bergant/finstr). Do you recommend any specific ways to evaluate the quality / usefulness of a given package other than just getting into it?

Davis - I think you've generally answered my question in terms of what I'm looking to do. I'm exploring the tidyverse now. Thanks again!


Hi Ryan I'm actually looking at doing something similar at the firm I work at. I remember using Finstr in college, mainly for optimizing portfolios, I didn't know it had tax-planning capabilities. Have you found it helpful at all for planning?




I think you have received good advice already and are on the right track with the tidyverse (I would include the tidyquant package, which was built by Davis Vaughan, one of your responders, and Matt Dancho). My reason for responding to this post is to speak to the question more generally.

As a CPA with Big 4 public company accounting and auditing experience, I think there is a HUGE opportunity for R to transform accounting/bookkeeping. The poster jlacko mentioned that R would be a poor fit for following a set of simple input tasks following hard coded "arcane" rules. However, I would argue programming is exactly the type of tool you would deploy to automate "arcane rules" such as those found in accounting and bookkeeping. That's why companies like Xero exist.

What's more, you have companies like Deloitte, PwC, KPMG and EY exploring how blockchain and programming languages like R and python can revolutionize the audit cycle. Suddenly, low risk transactions for an audit, such as expense classification, become a simple automated exercise for a machine learning or deep learning algorithm to execute with incredible accuracy and efficiency. And, if the algorithm is deployed by the company rather than the auditors, all that the auditors would have to do is audit the algorithm to ensure it is doing the right things. Then, they wouldn't have to audit a subset of the transactions in order to provide assurance that the company's financial statements are not misstated or misclassified. The time and cost savings are immense, and some companies already know this.

My guess as to why there are no fully developed packages for what you're looking for, other than the more general purpose data manipulation and analysis packages found in the tidyverse, is that there is little overlap between people who know accounting rules well and programming languages well.

Keep your eyes open, though. What you are ultimately looking for is coming from somewhere, I'm sure. It'll be here before you know it.


That's an interesting insight into how R and ML are making inroads into non-traditional areas.

One of those Big Four missed major fraud at my company by deliberately not auditing properly but still pocketing their fees for many years. Once this was uncovered the result was a massively reduced share price which tens of thousands of current and former employees have personal investments in. (Seeing their name really did trigger me :sob:).

I don't know whether auditing an algorithm would help in such cases or make matters more complex.