operations,-class {businessPlanR} | R Documentation |
S4 Class operations
Description
This class is used for objects that contain all transactions of the business plan.
Slots
period
A character vector defining beginning and end of the time period covered by the business plan. Values can either be a vector of two in
YYYY.MM
format, or a numeric vector of full fiscal years which will automatically be transformed into character.revenue
Data frame containing
type
,category
,name
, and all revenues, each month in a column namedYYYY.MM
. If these are not coveringperiod
exactly, missing values will be set to zero.expense
Data frame containing all expenses, data structure like the
revenue
slot.loan
Data frame, basically the
plan
slot as intransaction_plan
withplan_type="loan"
.depreciation
Data frame, like
loan
, but withplan_type="depreciation"
, respectively.misc
A list to keep miscellaneous data or information for documentation or re-use.
Constructor function
Should you need to manually generate objects of this class, the constructor function
operations(...)
can be used instead of
new("operations", ...)
.
Examples
rev_2019_2021_merch <- revenue(
type="Sale",
category="Merch",
name="T-Shirts",
"2019.01"=100,
"2019.08"=267,
"2020.03"=344,
"2020.09"=549,
"2021.02"=770,
"2021.07"=1022,
"2021.12"=1263
)
rev_2019_2021_rec <- revenue(
type="Sale",
category="Records",
name="Albums",
"2019.01"=220,
"2019.08"=234,
"2020.03"=221,
"2020.09"=354,
"2021.02"=276,
"2021.07"=285,
"2021.12"=311
)
rev_2019_2021_inv <- revenue(
type="Invest income",
category="Rent",
name="Studio",
"2019.01"=120,
"2019.08"=234,
"2020.03"=321,
"2020.09"=454,
"2021.02"=376,
"2021.07"=385,
"2021.12"=211
)
exp_2019_2021_merch <- expense(
type="Goods",
category="Merch",
name="T-Shirts",
"2019.01"=65,
"2019.07"=170,
"2020.02"=210,
"2020.08"=312,
"2021.01"=450,
"2021.06"=600,
"2021.12"=720
)
exp_2019_2021_rec <- expense(
type="Goods",
category="Records",
name="Pressing",
"2019.01"=1860,
"2019.02"=0,
"2020.08"=600,
"2020.09"=0,
"2021.12"=0
)
op_2019_2021 <- operations(
period=c("2019.01", "2021.12") # alternative: 2019:2021
)
update_operations(op_2019_2021) <- rev_2019_2021_merch
update_operations(op_2019_2021) <- exp_2019_2021_merch
update_operations(op_2019_2021) <- rev_2019_2021_rec
update_operations(op_2019_2021) <- exp_2019_2021_rec
update_operations(op_2019_2021) <- rev_2019_2021_inv