data_aggregating {PriceIndices} | R Documentation |
Aggregating the user's data frame
Description
The function aggregates the user's data frame over time and optionally over outlets.
Usage
data_aggregating(data, join_outlets = TRUE)
Arguments
data |
The user's data frame. |
join_outlets |
A logical value indicating whether the data aggregation over outlets should be also done. |
Value
The function aggregates the user's data frame over time and/or over outlets. Consequently, we obtain monthly data, where the unit value is calculated instead of a price for each prodID
observed in each month (the time
column gets the Date format: "Year-Month-01"). If the parameter join_outlets
is TRUE, then the function also performs aggregation over outlets (retIDs) and the retID
column is removed from the data frame. The main advantage of using this function is the ability to reduce the size of the data frame and the time needed to calculate the price index. Please note, that unnecessary columns are removed (e.g. description
).
Examples
#Example 1
data_aggregating(dataAGGR,join_outlets = FALSE)
data_aggregating(dataAGGR,join_outlets = TRUE)
#Example 2 (data frame reduction)
nrow(milk)
nrow(data_aggregating(milk))