sales {PriceIndices}R Documentation

Providing values of product sales

Description

The function returns values of sales of products with given IDs.

Usage

sales(data, period, set = c(), shares = FALSE, hist = FALSE)

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 product sales values (see also data_matching). If the set is empty, then the function returns sale values of all products being available in period.

shares

A logical parameter indicating whether the function is to return shares of product sales.

hist

A logical parameter indicating whether the function is to return histogram of product sales.

Value

The function analyzes the user's data frame and returns values of sales of products with given IDs and being sold in time period indicated by the period parameter (see also expenditures function which returns the expenditure values for sorted prodIDs).

Examples

sales(milk, period="2019-06", shares=TRUE, hist=TRUE)
sales(milk, period="2019-12",set=unique(milk$prodID)[1])

[Package PriceIndices version 0.1.9 Index]