Description Usage Arguments Value See Also Examples

View source: R/4_quantity_index.R

It is trivial to turn a price index into a quantity index by switching the role of prices and quantities in the index-number formula. This function does just that.

1 |

`price_index` |
A function to compute a price index. See |

A function like `price_index`

, except that the role of prices/quantities has been reversed.

`price_index`

for the possible functions that can serve as inputs.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
# Make some data
p0 <- price6[[2]]
q1 <- quantity6[[3]]
q0 <- quantity6[[2]]
# Just remaps argument names to be quantities rather than prices
quantity_index(index_laspeyres)(q1 = q1, q0 = q0, p0 = p0)
index_laspeyres(p1 = q1, p0 = q0, q0 = p0)
# Works with the index_weights() functions, too
quantity_index(index_weights("Laspeyres"))(q0 = q0, p0 = p0)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.