From 8669963cc5b0aa6004cf4b7f557f642aee0a6732 Mon Sep 17 00:00:00 2001 From: "Trevor L. Davis" Date: Mon, 20 May 2024 09:46:10 -0700 Subject: [PATCH] chore(README): Replace sourcecode with code due to Github rendering bug --- DESCRIPTION | 2 +- README.rst | 48 ++++++++++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 03b3c05..61ce936 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: ledger Type: Package Title: Utilities for Importing Data from Plain Text Accounting Files -Version: 2.0.11 +Version: 2.0.11-0 Authors@R: c(person("Trevor L.", "Davis", role=c("aut", "cre"), email="trevor.l.davis@gmail.com", comment = c(ORCID = "0000-0001-6341-4639")), diff --git a/README.rst b/README.rst index 1590784..d4d139f 100644 --- a/README.rst +++ b/README.rst @@ -81,7 +81,7 @@ The main function of this package is ``register`` which reads in the register of Here are some examples of very basic files stored within the package: -.. sourcecode:: r +.. code:: r library("ledger") @@ -107,7 +107,7 @@ Here are some examples of very basic files stored within the package: ## # ℹ 32 more rows -.. sourcecode:: r +.. code:: r hledger_file <- system.file("extdata", "example.hledger", package = "ledger") @@ -134,7 +134,7 @@ Here are some examples of very basic files stored within the package: ## # mv_commodity , id -.. sourcecode:: r +.. code:: r beancount_file <- system.file("extdata", "example.beancount", package = "ledger") @@ -165,7 +165,7 @@ Here are some examples of very basic files stored within the package: Here is an example reading in a beancount file generated by ``bean-example``: -.. sourcecode:: r +.. code:: r bean_example_file <- tempfile(fileext = ".beancount") @@ -194,7 +194,7 @@ Here is an example reading in a beancount file generated by ``bean-example``: ## # mv_commodity , tags , id -.. sourcecode:: r +.. code:: r suppressPackageStartupMessages(library("dplyr")) @@ -223,7 +223,7 @@ Using ``rio::import()`` and ``rio::convert()`` If one has loaded in the ``ledger`` package one can also use ``rio::import`` to read in the register: -.. sourcecode:: r +.. code:: r df2 <- rio::import(bean_example_file) @@ -249,7 +249,7 @@ The main advantage of this is that it allows one to use ``rio::convert`` to easi Some examples of using the ``net_worth`` function using the example files from the ``register`` examples: -.. sourcecode:: r +.. code:: r dates <- seq(as.Date("2016-01-01"), as.Date("2018-01-01"), by="years") @@ -266,7 +266,7 @@ Some examples of using the ``net_worth`` function using the example files from t ## 3 2018-01-01 USD 6743. 6264 -521. 1000 -.. sourcecode:: r +.. code:: r net_worth(hledger_file, dates) @@ -282,7 +282,7 @@ Some examples of using the ``net_worth`` function using the example files from t ## 3 2018-01-01 USD 6743. 7264 -521. -.. sourcecode:: r +.. code:: r net_worth(beancount_file, dates) @@ -298,7 +298,7 @@ Some examples of using the ``net_worth`` function using the example files from t ## 3 2018-01-01 USD 6743. 7264 -521. -.. sourcecode:: r +.. code:: r dates <- seq(min(as.Date(df$date)), max(as.Date(df$date)), by="years") @@ -325,7 +325,7 @@ Some examples of using the ``net_worth`` function using the example files from t Some examples using the ``prune_coa`` function to simplify the "Chart of Account" names to a given maximum depth: -.. sourcecode:: r +.. code:: r suppressPackageStartupMessages(library("dplyr")) @@ -353,7 +353,7 @@ Some examples using the ``prune_coa`` function to simplify the "Chart of Account ## 11 Liabilities USD -2382. -.. sourcecode:: r +.. code:: r df %>% prune_coa(2) %>% @@ -396,7 +396,7 @@ beancount example generated by ``bean-example``. First we load the (mainly tidyverse) libraries we'll be using and adjusting terminal output: -.. sourcecode:: r +.. code:: r library("ledger") @@ -416,7 +416,7 @@ First we load the (mainly tidyverse) libraries we'll be using and adjusting term Then we'll write some convenience functions we'll use over and over again: -.. sourcecode:: r +.. code:: r print_tibble_rows <- function(df) { @@ -442,7 +442,7 @@ Basic balance sheets Here is some basic balance sheets (using the market value of our assets): -.. sourcecode:: r +.. code:: r print_balance_sheet <- function(df) { @@ -466,7 +466,7 @@ Here is some basic balance sheets (using the market value of our assets): ## 3 2024-05-19 VACHR 110 110 0 -.. sourcecode:: r +.. code:: r print_balance_sheet(prune_coa(df, 2)) @@ -484,7 +484,7 @@ Here is some basic balance sheets (using the market value of our assets): ## 1 Liabilities:US USD -1701. -.. sourcecode:: r +.. code:: r print_balance_sheet(df) @@ -511,7 +511,7 @@ Basic net worth chart Here is a basic chart of one's net worth from the beginning of the plaintext accounting file to today by month: -.. sourcecode:: r +.. code:: r next_month <- function(date) { @@ -531,7 +531,7 @@ Basic income sheets ~~~~~~~~~~~~~~~~~~~ -.. sourcecode:: r +.. code:: r month_cutoff <- zoo::as.yearmon(Sys.Date()) - 2/12 @@ -585,7 +585,7 @@ Basic income sheets ## 3 USD net 2410. 2984. 2992. -.. sourcecode:: r +.. code:: r print_income(prune_coa(df, 2)) @@ -599,7 +599,7 @@ Basic income sheets ## 1 Income:US USD 11115. 10479. 5240. -.. sourcecode:: r +.. code:: r print_expenses(prune_coa(df, 2)) @@ -618,7 +618,7 @@ Basic income sheets ## 6 Expenses:Transport USD 120 120 0 -.. sourcecode:: r +.. code:: r print_income(df) @@ -636,7 +636,7 @@ Basic income sheets ## 5 Income:US:ETrade:PnL USD -59.8 0 0 -.. sourcecode:: r +.. code:: r print_expenses(df) @@ -674,7 +674,7 @@ Basic income sheets And here is a plot of income, expenses, and net income over time: -.. sourcecode:: r +.. code:: r ggplot(compute_total(df), aes(x=yearmon, y=amount, group=commodity, colour=commodity)) +