This is a container class for multiple objects of either class depreciation
or
loan
,
similar to operations
for revenues and expenses.
Its main data frame stores each transaction object in multiple rows.
Investment have three rows, investment
, depreciation
,
and remaining value
, while loans have six named
balance_start
, interest
, principal
, total
, cumsum
,
and balance_remain
, repectively.
This makes it easier to create nice overview tables via kable_bpR
.
plan_type
One of "depreciation"
or "loan"
,
defining which type of transactions are accumulated in the object.
plan
A data frame with three rows for each depreciation
or
six for each loan
class object added to it, e.g.,
via update_plan
.
Should you need to manually generate objects of this class, the constructor function
transaction_plan(...)
can be used instead of
new("transaction_plan", ...)
.
The data frame has four meta data columns, type
, category
, name
,
and part
, followed by a column for each month
covered by any of the contained transaction
objects. The first three columns take their values from the respective object,
while
the fourth, part
, defines the rows as explained earlier.
depreciation_printer <- depreciation(
type="Depreciation",
category="Office",
name="Printer",
amount=100,
obsolete=36,
invest_month="2019.04"
)
depreciation_laptop <- depreciation(
type="Depreciation",
category="Office",
name="Laptop",
amount=1200,
obsolete=36,
invest_month="2019.02"
)
# initialize an empty plan
dep_plan <- transaction_plan()
# add your assets to the plan
update_plan(dep_plan) <- depreciation_printer
update_plan(dep_plan) <- depreciation_laptop
Run the code above in your browser using DataLab