values: Compute values (price x quantity)

Description Usage Arguments Examples

View source: R/values.R

Description

Compute the total value (expenditure), for each time period in the sample.

Usage

1
2
3
4
5
6
7
8
9
values(
  x,
  pvar,
  qvar,
  pervar,
  prodID,
  sample = "matched",
  matchPeriod = "previous"
)

Arguments

x

A dataframe containing price, quantity, a time period identifier and a product identifier. It must have column names.

pvar

A character string for the name of the price variable

qvar

A character string for the name of the quantity variable

pervar

A character string for the name of the time variable. This variable must contain integers starting at period 1 and increasing in increments of 1 period. There may be observations on multiple products for each time period.

prodID

A character string for the name of the product identifier

sample

A character string specifying whether a matched sample should be used.

matchPeriod

A character string specifying which period is used to determine the set of products used for matching. Options are "following" or "previous". "following" calculates the expenditures in the current period, filtering out any products that do not appear in the following period. "previous" is calculated similarly, using the set of products in the previous period to filter the current period sample.

Examples

1
2
values(CES_sigma_2, pvar = "prices", qvar = "quantities", pervar = "time",
prodID = "prodID", matchPeriod = "previous")

IndexNumR documentation built on Feb. 7, 2022, 5:09 p.m.