loan,-class {businessPlanR} | R Documentation |
This is a special case of the generic class transaction
.
## S4 method for signature 'loan'
initialize(
.Object,
type,
category,
name,
amount,
period,
interest,
first_month = format(Sys.Date(), "%Y.%m"),
schedule = c("annuity", "amortization", "maturity"),
due_month = NA,
valid_types = "default",
value
)
.Object |
The object to initialize. |
type |
A character string defining the type of transaction as defined by |
category |
A character string, custom category for this transaction. |
name |
A character string, custom name or ID for this transaction. |
amount |
Numeric, the amount of money loaned. |
period |
Integer, number of months to fully repay the loan. |
interest |
Numeric, the nominal interest rate per annum (a value between 0 and 1). |
first_month |
Character string in |
schedule |
One of the following, defining the repayment schedule:
|
due_month |
Integer value defining the first month of principal repayment. The selected |
valid_types |
A character string,
the model types defined by |
value |
A valid data frame to be used as the value slot directly,
omitting calculation via |
In contrast to revenue
or expense
,
the time range of this class of objects is defined by details of the loan as specified. Only when used as
an aspect of an operations
class object,
this range is adjusted
to fit that particular object.
type
A character string,
for valid values see valid_types
. You might use all valid types pre-defined for either
revenue
or expense
,
considering that you might be the loan giver or receiver.
category
A character string, custom category for this loan.
name
A character string, custom name or ID for this loan.
value
Data frame containing an amortization schedule for the loan,
each month in a row named YYYY.MM
.
It has a row for each month and the columns balance_start
, interest
,
principal
, total
,
cumsum
, and balance_remain
.
valid_types
A character string, the model types defined by
set_types
to be used for validation.
Should you need to manually generate objects of this class, the constructor function
loan(...)
can be used instead of
new("loan", ...)
.
Should you need to manually generate objects of this class, the constructor function
loan(...)
can be used instead of
new("loan", ...)
.
loan_2019 <- loan(
type="Interest",
category="Bank",
name="New office",
amount=10000,
period=60,
interest=0.075,
first_month="2019.04",
schedule=c("amortization")
)
# turn loan object into an expense
loan_as_expense_2019 <- as_transaction(
loan_2019,
to="expense",
aspect="interest"
)