View source: R/data_management.R
as_cov_names | R Documentation |
In RprobitB, alternative specific covariates must be named in the format
"<covariate>_<alternative>"
. This convenience function generates
the format for a given choice_data
set.
as_cov_names(choice_data, cov, alternatives)
choice_data |
A |
cov |
A character vector of the names of alternative specific covariates in
|
alternatives |
A (character or numeric) vector of the alternative names. |
The choice_data
input with updated column names.
data("Electricity", package = "mlogit") cov <- c("pf","cl","loc","wk","tod","seas") alternatives <- 1:4 colnames(Electricity) Electricity <- as_cov_names(Electricity, cov, alternatives) colnames(Electricity)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.