| outlet_check | R Documentation |
The general purpose of the function is to determine in what proportion of the retail chain’s outlets the number of matched products within the analyzed time interval (or at its boundaries) exceeds a certain minimum specified by the user. The input data set (data frame) must contain matched products over time, i.e. it must contain the prodID column (as numeric, factor or character) and the grouping variable (i.e., an optional column) selected via by parameter.
outlet_check(
data,
start,
end,
by = c(),
minN = 2,
threshold = 0.9,
interval = FALSE
)
data |
The user's data frame with information about sold products. It must contain columns: |
start |
The base period (as character) limited to the year and month, e.g. "2020-03". |
end |
The research period (as character) limited to the year and month, e.g. "2020-04". |
by |
This parameter specifies the name of the grouping column (as character). If the user does not specify any column via the |
minN |
This parameter specifies the required minimum number of matched products present in a single outlet, within the grouping defined via the |
threshold |
The lower bound of the acceptable fraction of complete outlets, i.e., outlets in which the number of matched products referred to above is not less than the |
interval |
A logical value indicating whether the reducing process concerns only two periods defined by |
The function first determines the fraction of outlets (within subsets defined by the grouping column specified by the by parameter) that are complete, i.e., those containing at least minN matched products. If this fraction exceeds the value specified by threshold, a resulting data frame df is created consisting only of complete outlets, and the variable result is set to TRUE. Otherwise, df remains the original data, and the variable result is set to FALSE. The function returns a list consisting of the following elements: fraction (indicating the fraction of complete outlets), result, and df. This function can be used to automatically set the values of the data and outlets parameters in the final_index function.
outlet_reduction <-
outlet_check(coffee, start="2018-12", end="2019-12",
minN=3, by="description", interval=TRUE)
outlet_reduction$fraction
outlet_reduction$result
outlet_reduction$df
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.