add_variable: 'add_variable' adds columns to the data matrix

Description Usage Arguments Value Examples

Description

add_variable adds columns to the data matrix

Usage

1
add_variable(data = data, dname = "chc", weights = NULL)

Arguments

data

data.frame, if dname=="chc" columns "chc_i" has to be in the data.

dname

if dname=="chc" (dummy for chosen alternative) dummy for the choice alternative added, if "weights" weights added

weights

Matrix with weights to be added to the data

Value

data.frame

Examples

1
2
3
4
5
chc <- c(1,2,1,4,3,1,4)
data <- data.frame(choice=chc, x=rnorm(length(chc)), y=rnorm(length(chc)))
add_variable(data, dname="chc")
ww <- c(1,1,1,2,2,2,3)
add_variable(data, dname="weights", weights=ww)

nmm documentation built on Jan. 7, 2021, 5:10 p.m.

Related to add_variable in nmm...