compare_indices_list: A general function for graphical comparison of price indices

View source: R/f_comparing_indices.R

compare_indices_listR Documentation

A general function for graphical comparison of price indices

Description

This function returns a figure with plots of previously calculated price indices.

Usage

compare_indices_list(data = list(), names = c(), date_breaks = "1 month")

Arguments

data

A list of data frames with previously calculated price indices. Each data frame must consist of two columns, i.e. the first column must includes dates limited to the year and month (e.g.: "2020-04") and the second column must indicate price index values for corresponding dates. The above-mentioned single data frame may be created manually in the previous step or it may be a result of functions: price_index or final_index. All considered data frames must have an identical number of rows.

names

A vector of character strings describing names of presented indices.

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 previously calculated price indices. It allows for graphical comparison of price index values which were previously calculated and now are provided as a list of data frames (see data parameter).

Examples

## Caluclating two indices by using two different package functions:
index1<-final_index(data=milk, start="2018-12", 
end="2019-12",formula="walsh",interval=TRUE)
index2<-price_indices(milk,start="2018-12", end="2019-12",
formula="geks",window=13,interval=TRUE)
## Graphical comparison of these two indices 
compare_indices_list(data=list(index1,index2), 
names=c("Walsh index", "GEKS index"))

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