Skip to content

Commit

Permalink
chore(README): Replace sourcecode with code due to Github rendering bug
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorld committed May 20, 2024
1 parent 6fabbdc commit 8669963
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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="[email protected]",
comment = c(ORCID = "0000-0001-6341-4639")),
Expand Down
48 changes: 24 additions & 24 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -134,7 +134,7 @@ Here are some examples of very basic files stored within the package:
## # mv_commodity <chr>, id <chr>


.. sourcecode:: r
.. code:: r
beancount_file <- system.file("extdata", "example.beancount", package = "ledger")
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -194,7 +194,7 @@ Here is an example reading in a beancount file generated by ``bean-example``:
## # mv_commodity <chr>, tags <chr>, id <chr>


.. sourcecode:: r
.. code:: r
suppressPackageStartupMessages(library("dplyr"))
Expand Down Expand Up @@ -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)
Expand All @@ -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")
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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")
Expand All @@ -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"))
Expand Down Expand Up @@ -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) %>%
Expand Down Expand Up @@ -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")
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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))
Expand All @@ -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)
Expand All @@ -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) {
Expand All @@ -531,7 +531,7 @@ Basic income sheets
~~~~~~~~~~~~~~~~~~~


.. sourcecode:: r
.. code:: r
month_cutoff <- zoo::as.yearmon(Sys.Date()) - 2/12
Expand Down Expand Up @@ -585,7 +585,7 @@ Basic income sheets
## 3 USD net 2410. 2984. 2992.


.. sourcecode:: r
.. code:: r
print_income(prune_coa(df, 2))
Expand All @@ -599,7 +599,7 @@ Basic income sheets
## 1 Income:US USD 11115. 10479. 5240.


.. sourcecode:: r
.. code:: r
print_expenses(prune_coa(df, 2))
Expand All @@ -618,7 +618,7 @@ Basic income sheets
## 6 Expenses:Transport USD 120 120 0


.. sourcecode:: r
.. code:: r
print_income(df)
Expand All @@ -636,7 +636,7 @@ Basic income sheets
## 5 Income:US:ETrade:PnL USD -59.8 0 0


.. sourcecode:: r
.. code:: r
print_expenses(df)
Expand Down Expand Up @@ -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)) +
Expand Down

0 comments on commit 8669963

Please sign in to comment.