On 2015-10-20 06:26:44 +0000, Phil Gee said:

@lifepillar,

thanks für the feedback! Regarding the usage of vim with R I unfortunately do not know much, but have you tried this plugin: http://www.vim.org/scripts/script.php?script_id=2628

Not yet, but it looks promising!

- I will at least look upon the sourcecode of the Ledger-plugin. Heat maps of the net worth sound too interesting not to be implemented!

You may see the ggplot2 code for it in tile-total-vs-week-wday-facet-year.r.
To use this and the other charts, you need to build a data frame from a Ledger report. I use the following format to get the data in a uniform shape (this is one line):

'%(format_date(date,\"%Y-%m-%d;%Y;%b;%m;%a;%u;%W;%d\"));%(quantity(scrub(display_amount)));%(quantity(scrub(display_total)));%(payee);%(display_account)\n'

Then I build an R script along these lines:

   ledger_command <- '...' # here goes a Ledger command using the format above
   ledger_data <- read.csv(pipe(ledger_command), header=F, sep=";")
   names(ledger_data) <-c("date", "year", "month", "month_num", "wday",
     "wday_num", "week", "mday", "amount", "total", "payee", "account")
   ledger_data$date <- as.Date(ledger_data$date, "%Y-%m-%d")
   ledger_data$month <- factor(ledger_data$month, levels = c("Jan", "Feb",
     "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"),
     ordered=TRUE)

Now I have a data frame with enough information to build most kinds of plots
(the only exception being budgets, for which I use a different format).
All the .r files in the plugin use the code above. It should not be difficult
to re-use that code. For all the details, you may take a look at the file
statistics.rb.

Life


--

--- You received this message because you are subscribed to the Google Groups "Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to