expire_status_by_inventory: change active status at end of inventory

Description Usage Arguments Value Functions See Also

View source: R/expire_status_by_inventory.R

Description

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.

Usage

 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
)

Arguments

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

Value

a data frame

Functions

See Also

expire_status


renlund/dm documentation built on Jan. 18, 2022, 9:50 a.m.