Description Usage Arguments Value Functions See Also
View source: R/expire_status_by_inventory.R
Note: this is a rigid function that requires variabes 'id' and 't'. This
function behaves much like expire_status
, but the expiration boundary
is determined by end of inventory. At times 't' an individual ('id') gets
its inventory replenished by 'inventory' (which can be a fixed number or
given by that variable in the input data frame 'x'). The inventory
diminishes by 'usage' (1, by default) each unit of time. This function
calculates a 'status' variable which will be 1 as long as there is available
inventory, and 0 when it runs out.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | expire_status_by_inventory(
x,
inventory = NULL,
usage = 1,
overflow_at = Inf,
slim = FALSE
)
expire_state_by_inventory(
x,
inventory = NULL,
usage = NULL,
overflow_at = NULL,
null.state = "",
slim = FALSE
)
|
x |
a data frame that contains 'id' and 't' |
inventory |
inventory, if NULL needs to exists in 'x', if not NULL a variable called 'inventory' will be created with the value(s) given here |
usage |
numeric; depreciation of inventory per unit of time |
overflow_at |
numeric; upper bound to inventory |
slim |
logical; remove unnecessary statuses? If TRUE 'inventory' will be dropped from the output as this data is no longer complete |
null.state |
value assigned to expired state |
a data frame
expire_state_by_inventory
: generalization of
expire_status_by_inventory; the 'status' - now called 'state' - can be
multivalued; 'usage' and 'overflow_at' can be variables in 'x'
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.