computeUnderperformer {matman} | R Documentation |
Select underperforming items
Description
Selects items with a value lower than a given threshold for a specified time period.
Usage
computeUnderperformer(
data,
value,
group,
timestamp,
timestampFormat = c("day", "week", "month", "quater", "year"),
currentTime,
thresholdValue = 0,
thresholdTime = 90,
use_latest = FALSE
)
Arguments
data |
Dataframe containing item stock data. |
value |
Name of the column variable containing the stock values. |
group |
Name(s) of the column(s) that are used to group stock data. These columns are usually the item ID or item name to group stock data by items. |
timestamp |
Name of the column including the timestamp. This column should be in Date, POSIX , YY-mm, YYYY-'W'ww, YYYY-mm, YYYY-'Q'q or YYYY format. |
timestampFormat |
Declares in which format the timestamp comes in (i.e., "day", "week", "month", "quarter", "year") |
currentTime |
Qualifying date for the value variable. Date must exist in data and have the same format as timestamp-variable. |
thresholdValue |
Name of the colum variable containing the items' stock threshold value or the threshold value used in this analysis for all items. |
thresholdTime |
Time for which the value shouldn't exceed the threshold value. Number declares the time in the format of timestampFormat |
use_latest |
boolean value. If TRUE data will expand and dates with noexisting values will be filled up with the latest known values |
Value
Returns a data frame listing all underperforming items, the date their stock was the last time over the threshold (lastover), the duration in days since the stock is under the threshold (toolowindays), the average difference between the stock and the threshold (meandiff) and the count of switched between over- and underperformance (moves).
Author(s)
Leon Binder leon.binder@th-deg.de
Bernhard Bauer bernhard.bauer@th-deg.de
Michael Scholz michael.scholz@th-deg.de
See Also
computeOverperformer
computeConstants
Examples
data("Stocks")
underperformer = computeUnderperformer(data=Stocks,
value = "stock",
group = "item",
timestamp = "date",
timestampFormat = "day",
currentTime = "2019-07-27",
thresholdValue = "minstock",
thresholdTime = 90,
use_latest = FALSE)