| transaction_plan,-class {businessPlanR} | R Documentation |
S4 Class transaction_plan
Description
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.
Details
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.
Slots
plan_typeOne of
"depreciation"or"loan", defining which type of transactions are accumulated in the object.planA data frame with three rows for each
depreciationor six for eachloanclass object added to it, e.g., viaupdate_plan.
Constructor function
Should you need to manually generate objects of this class, the constructor function
transaction_plan(...) can be used instead of
new("transaction_plan", ...).
Examples
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