pqcor: Providing a correlation coefficient for price and quantity of sold products
Description
The function returns correlation between price and quantity of sold products with given IDs.
Usage
pqcor(data, period, set = c(), figure = FALSE)
Value
The function returns Pearson's correlation coefficient between price and quantity of products with given IDs and sold in period.
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 correlation between price and quantity of sold products (see also data_matching). If the set is empty, the function works for all products being available in period.
figure
A logical parameter indicating whether the function returns a figure (TRUE) or a data frame (FALSE) with correlations between price and quantity of sold products.