ec_util_choice_to_long: Convert a vector of choices to long format
Description
Converts a vector of choices into a long format data frame, where each row represents
a single choice and contains the choice status for each alternative.
Usage
ec_util_choice_to_long(myvec, all_index)
Value
A tibble with columns 'x', 'task', and 'alt', where 'x' is a binary indicator of whether
the alternative was chosen or not, 'task' is the task index, and 'alt' is the alternative index.
Arguments
myvec
A vector of choices, where each element represents the index of the chosen alternative.
#There are 3 alternatives in this task. #Since there are 3 observations in myvec, there are 3 tasks total.ec_util_choice_to_long(c(1, 2, 1), c(1, 2, 3))