Learn R Programming

beezdemand (version 0.2.0)

ChangeData: ChangeData

Description

Changes demand data

Usage

ChangeData(
  dat,
  nrepl = 1,
  replnum = 0.01,
  rem0 = FALSE,
  remq0e = FALSE,
  replfree = NULL,
  xcol = "x",
  ycol = "y",
  idcol = "id"
)

Value

Long form dataframe resembling the originally provided dataframe

Arguments

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

Author

Brent Kaplan bkaplan.ku@gmail.com

Details

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.

Examples

Run this code
## Change just the first instance of 0 within each unique value of id with .1
ChangeData(apt, nrepl = 1, replnum = .1)

Run the code above in your browser using DataLab