Recode a data frame to create dummy-coded categorical and interaction variables.
Recodes a list of a dataframe (data
) and two vectors (parNames
and
randPars
) with discrete (categorical) variables and interaction variables
added to the data frame as well as the parNames
and randPars
. This
function is used internally inside the main logitr()
function but is also
exported for use in other libraries.
recodeData(data, parNames, randPars)
data |
The choice data, formatted as a |
parNames |
The names of the parameters to be estimated in the model.
Must be the same as the column names in the |
randPars |
A named vector whose names are the random parameters and
values the distribution: |
A list of a dataframe (data
) and two vectors (parNames
and
randPars
) with discrete (categorical) variables and interaction variables
added.
data(yogurt) result <- recodeData( data = yogurt, parNames = c("price", "feat", "brand", "price*brand"), randPars = c(feat = "n", brand = "n") ) result$parNames result$randPars head(result$data)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.