expire_status: change active status at expiration boundary

View source: R/expire_status.R

expire_statusR Documentation

change active status at expiration boundary

Description

Note: this is a rigid function that needs variables 'id' and 't' (and optionally 'expire') and will create a variable 'status' (if such exists it will be overwritten). Feed this function a data frame with variables 'id' (identifier) and 't' (integer valued time measurement) and - optionally - 'expire' (positive numeri). 't' represents times for some event whose status (1) should expire (to 0) (strictly) after the integer duration specified by 'expire' (unless the status is "refreshed" by having another 't'-value before expiration). Duplicated times (per individual) will always be removed, and the output can also be reduced to the smallest output that keeps track of the changing status by setting parameter 'slim' to TRUE.

Usage

expire_status(x, expire = NULL, slim = FALSE)

expire_state(x, expire = NULL, null.state = "", slim = FALSE)

Arguments

x

data frame with id variable 'id' and time variable 't'

expire

expiration boundary, if NULL needs to exists in 'x', if not NULL a variable called 'expire' will be created with the value(s) given here

slim

logical; remove unnecessary statuses?

null.state

value assigned to expired state

Value

a data frame

Functions

  • expire_state(): generalization of expire_status; the 'status' - now called 'state' (which must exist in 'x') - can be multivalued

See Also

expire_status_by_inventory, expire_state_by_inventory


renlund/datma documentation built on June 2, 2025, 5:12 a.m.