prices: Providing prices (unit values) of sold products
Description
The function returns prices (unit values) of sold products with given IDs.
Usage
prices(data, period, set = c(), ID = FALSE)
Value
The function analyzes the user's data frame and returns prices (unit value) of products with given ID and being sold in the time period indicated by the period parameter. Please note, that the function returns the price values for sorted prodIDs and in the absence of a given prodID in the data set, the function returns nothing (it does not return zero). If the ID parameter is set to TRUE then the function returns a data frame with columns: by (IDs of products) and uv (unit values of products).
Arguments
data
The user's data frame. It must contain columns: time (as Date in format: year-month-day, e.g. '2020-12-01'), prices (as positive numeric), quantities (as positive numeric) and prodID (as numeric, factor or character) with unique product IDs.
period
The time period (as character) limited to the year and month, e.g. "2019-03".
set
The set of unique product IDs to be used for determining prices of sold products (see also data_matching). If the set is empty, the function returns prices of all products being available in period.
ID
A logical parameter indicating whether a data frame with prodIDs and prices (unit values) should be returned.