Description Usage Arguments Value Examples
spread_data
is written to work with functions from
the revealedPrefs package.
checkWarp
and similar "check" functions
take as input two n
by i
matrices, one for goods and one for prices.
spread_data
takes a dataframe and returns a list with two matrices, which
can then be passed into checkWarp
and similar functions.
1 | spread_data(df, ...)
|
df |
a dataframe containing columns with quantities and prices of goods |
... |
the columns within |
a list containg two matrices:
a matrix containing quantities
a matrix containing prices
1 2 3 4 5 | # use simGarp and gather_data to create a sample df containing 4 observations and 6 columns (3 quantities and 3 prices)
df <- simGarp(4, 3) %>% gather_data()
# use spread_data to return a list of two matrices
spread_data(df, x1, x2, x3, p1, p2, p3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.