products_fig: Function for graphical comparison of available, matched, new...

View source: R/f_data_processing.R

products_figR Documentation

Function for graphical comparison of available, matched, new as well as disappearing products.

Description

This function returns a figure with plots of volume (or contributions) of available, matched, new as well as disappearing products.

Usage

products_fig(
  data,
  start,
  end,
  show = c("available", "matched", "new", "disappearing"),
  fixed_base = TRUE,
  contributions = TRUE,
  date_breaks = "1 month"
)

Arguments

data

The user's data frame with information about sold products. It must contain columns: time (as Date in format: year-month-day,e.g. '2020-12-01') and prodID (as numeric, factor or character).

start

The base period (as character) limited to the year and month, e.g. "2020-03".

end

The research period (as character) limited to the year and month, e.g. "2020-04".

show

A character vector indicating which groups of products are to be taken into consideration. Available options are available, matched, new and disappearing.

fixed_base

A logical parameter indicating whether each month is to be compared to the base period (TRUE) or to the previous month (then it is set to FALSE).

contributions

A logical parameter indicating whether contributions or volumes counted for available, matched, new and disappearing products are to be displayed.

date_breaks

A string giving the distance between breaks on the X axis like "1 month" (default value) or "4 months".

Value

This function returns a figure with plots of volume (or contributions) of available, matched, new as well as disappearing products. The User may control which groups of products are to be taken into consideration (see the show parameter). Available options are available, matched, new and disappearing.

Examples

products_fig(milk, "2018-12","2019-04", 
fixed_base=TRUE, contributions=FALSE,
show=c("new","disappearing","matched","available"))

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