ChangeData: ChangeData

Description Usage Arguments Details Value Author(s) Examples

View source: R/change.R

Description

Changes demand data

Usage

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

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

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.

Value

Long form dataframe resembling the originally provided dataframe

Author(s)

Brent Kaplan <bkaplan.ku@gmail.com>

Examples

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

beezdemand documentation built on May 2, 2019, 9:27 a.m.