matched_fig: Providing a time dependent matched_index() function

matched_figR Documentation

Providing a time dependent matched_index() function

Description

The function provides a data frame or a figure presenting the matched_index function calculated for the column defined by the type parameter and for each month from the considered time interval

Usage

matched_fig(
  data,
  start,
  end,
  base = "start",
  type = "prodID",
  fixedbase = TRUE,
  figure = TRUE,
  date_breaks = "1 month"
)

Arguments

data

The user's data frame. It must contain a column time (as Date in format: year-month-day,e.g. '2020-12-01') and also a column indicated by the type parameter.

start

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

end

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

base

The base period (as character) for product comparisons. Its possible values are: "start" and "end".

type

This parameter defines the column which is used in the procedure. Possible values of the type parameter are: retID, prodID, codeIN, codeOUT or description.

fixedbase

A logical parameter indicating whether the procedure is to work for subsequent months from the considered time interval (fixedbase=FALSE). Otherwise the period defined by base plays a role of fixed base month (fixedbase=TRUE)

figure

A logical parameter indicating whether the function returns a figure (TRUE) or a data frame (FALSE) with matched_index values.

date_breaks

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

Value

The function returns a data frame or a figure presenting the matched_index function calculated for the column defined by the type parameter and for each month from the considered time interval. The interval is set by start and end parameters. The returned object (data frame or figure) depends on the value of figure parameter. The returned values belong to [0,1].

Examples

matched_fig(milk, start="2018-12", end="2019-12")
matched_fig(milk, start="2018-12", end="2019-12", figure=FALSE)

PriceIndices documentation built on Oct. 10, 2024, 1:07 a.m.