ChangeData | R Documentation |
Changes demand data
ChangeData(
dat,
nrepl = 1,
replnum = 0.01,
rem0 = FALSE,
remq0e = FALSE,
replfree = NULL,
xcol = "x",
ycol = "y",
idcol = "id"
)
dat |
A long form dataframe |
nrepl |
Number of zeros to replace with replacement value (replnum). Can accept either a number or "all" if all zeros should be replaced. Default is to replace the first zero only |
replnum |
Value to replace zeros. Default is .01 |
rem0 |
If TRUE, removes all 0s in consumption data prior to analysis. Default value is FALSE |
remq0e |
If TRUE, removes consumption and price where price == 0. Default value is FALSE |
replfree |
Optionally replaces price == 0 with specified value. |
xcol |
Column name in dataframe that signifies x values (usually price or the IV) |
ycol |
Column name in dataframe that signifies y values (usually consumption or the DV) |
idcol |
Column name in dataframe that signifies identifying id grouping |
Change demand data in various ways. Ways include replacing any number of 0 values with a replacement number (or remove them completely), removing price and consumption at free, replacing free with some number. This will soon replace ReplaceZeros and certain arguments in FitCurves.
Long form dataframe resembling the originally provided dataframe
Brent Kaplan <bkaplan.ku@gmail.com>
## Change just the first instance of 0 within each unique value of id with .1
ChangeData(apt, nrepl = 1, replnum = .1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.