1
0
Fork
You've already forked ledger-R-report
0
Personnal R code for ledger-cli reports
  • R 100%
2024年05月10日 14:24:46 +02:00
ledger-R-report.R Moar eyecandycd ledger-R-report/ And stacked area plots for better view of percentage per month 2024年05月10日 14:24:46 +02:00
LICENSE Initial commit 2024年05月08日 17:14:37 +00:00
README.md Moar eyecandycd ledger-R-report/ And stacked area plots for better view of percentage per month 2024年05月10日 14:24:46 +02:00

ledger-R-report

Personnal (read "Strongly opinionated") R code to make sense of ledger-cli reports. Given a basic csv export from ledger-cli (Monthly formatted), it computes some stats (per year) and plots.

Reported stats :

  • quartiles (Five-number summary) ;
  • mean and standard deviation ;
  • total per account (currency and percentage), "parentAccount".

Reported plots :

  • amount per account and month ;
  • stacked amount per account and month ;
  • boxplots per account per year (visual equivalent to the five-number summary).

Installation

Just download the R file, as simple as it gets.

In addition to the basic ones, multiple R package are necessary though :

  • readr ;
  • dplyr ;
  • tidyr ;
  • ggplot2.

Those may be overkill for this use, but most people would have them already installed anyway. Each package is called right before their use in the code.

Usage

Simply run the following snippet :

./ledger-R-report.R [OPTIONS] file.ledger

Options are provided :

  • --help - Print help text ;
  • --index - "Privacy friendly" output with relative values instead of absolute ;
  • --no-stat - No summary statistics (Saved as /tmp/summary.csv) ;
  • --no-plot - No plots (Saved as Rplots.pdf).

The code is pretty simple due to the format of the ledger's month export which only includes the date, account, currency, and amount.

Note that I only use one currency, and split my logs per year (which may or not generate a bias to the summary depending on recent life changes). The official documentation presents a way to split compound logs. If multiple years are in the same file, don't forget to remove the second section of code which is used to keep only the last entry year.

Contributing

Go fork yourself ; Unless I feel the need for it I probably won't update this code which I built for my own use. It's only publicly shared 'cause I thought other solutions were bloated due to support for uncommon cases, and some people may feel the same way about it.

If I ever update this, it would be to add eye-candy to the plots which are still pretty ugly as it is.

See also

Licence

The code is licensed under GPL3.0+.