sales_groups2: Providing information about sales of products

View source: R/f_data_processing.R

sales_groups2R Documentation

Providing information about sales of products

Description

The function returns values of sales of products or the corresponding barplot for these sales.

Usage

sales_groups2(
  data = data.frame(),
  by,
  start,
  end,
  shares = FALSE,
  barplot = FALSE,
  names = c()
)

Arguments

data

The user's data frame with subgroups of sold products (see by parameter). The data frame must contain columns: time (as Date in format: year-month-day, e.g. '2020-12-01'), prices (as positive numeric) and quantities (as positive numeric). An additional column indicated via by parameter is also needed.

by

The column name indicating grouping variable, i.e. this column is used for creating subgroups of products.

start

The beginning of the considered time interval (as character) limited to the year and month, e.g. "2020-03".

end

The end of the considered time interval (as character) limited to the year and month, e.g. "2020-04".

shares

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

barplot

A logical parameter indicating whether the function is to return barplot for product sales.

names

A vector of characters describing product groups defined by datasets.

Value

The function returns values of sales of products or the corresponding barplot for these sales (if barplot is TRUE). Alternatively, it calculates the sale shares (if shares is TRUE).

Examples

outlets<-as.character(unique(milk$retID))
sales_groups2(milk,by="retID",start="2019-04",end="2019-04",
shares=TRUE,barplot=TRUE,names=outlets)

PriceIndices documentation built on July 9, 2023, 6:20 p.m.