depreciation,-class {businessPlanR} | R Documentation |
S4 Class depreciation
Description
This is a special case of the generic class transaction
.
Usage
## S4 method for signature 'depreciation'
initialize(
.Object,
type,
category,
name,
amount,
obsolete,
invest_month = format(Sys.Date(), "%Y.%m"),
method = c("linear", "writedown", "sumofyears", "doubledecline"),
valid_types = "default",
value
)
Arguments
.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 (i.e., a particular asset that was purchased). |
amount |
Numeric, the amount of money invested into the asset. |
obsolete |
Integer value defining the period (in months) over which the value of the asset diminishes to zero. |
invest_month |
Character string in |
method |
One of the following, defining the depreciation method:
|
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 |
Details
In contrast to revenue
or expense
,
the time range of this class of objects is defined by details of the investment as specified. Only when used as
an aspect of an operations
class object,
this range is adjusted
to fit that particular object.
Slots
type
A character string, for valid values see
valid_types
. You might use all valid types pre-defined for eitherrevenue
orexpense
, considering that you might be the depreciation giver or receiver.category
A character string, custom category for this depreciation.
name
A character string, custom name or ID for this depreciation.
value
Data frame containing an investment plan and allowance for depreciation balance, each month in a row named
YYYY.MM
. The columns areinvestment
,depreciation
, and remainingvalue
.valid_types
A character string, the model types defined by
set_types
to be used for validation.
Constructor function
Should you need to manually generate objects of this class, the constructor function
depreciation(...)
can be used instead of
new("depreciation", ...)
.
NA
Should you need to manually generate objects of this class, the constructor function
depreciation(...)
can be used instead of
new("depreciation", ...)
.
Examples
depreciation_printer <- depreciation(
type="Depreciation",
category="Office",
name="Printer",
amount=100,
obsolete=36,
invest_month="2019.04"
)
# turn depreciation object into an expense
depreciation_as_expense_printer <- as_transaction(
depreciation_printer,
to="expense",
aspect="depreciation"
)