Make a projoint_data object using a labelled tibble (data frame)
make_projoint_data.Rd
This function converts a labelled tibble (data frame) to a "projoint_data" class object necessary for projoint
.
Usage
make_projoint_data(
.dataframe,
.attribute_vars,
.id_var = "id",
.task_var = "task",
.profile_var = "profile",
.selected_var = "selected",
.selected_repeated_var = NULL,
.fill = FALSE
)
Arguments
- .dataframe
A data frame. The unit of observation must be each of two profiles in each task for each respondent.
- .attribute_vars
A character vector identifying the names of attributes
- .id_var
A character identifying the name of a column containing respondent IDs (default: "id")
- .task_var
A character identifying the name of a column containing task numbers (default: "task")
- .profile_var
A character identifying the name of a column containing profile numbers IDs (default: "profile")
- .selected_var
A character identifying the name of a column containing each dichotomous response (0, 1) for each task (default: "selected")
- .selected_repeated_var
A character identifying the name of a column containing each dichotomous response (0, 1) for the repeated task (default: NULL)
- .fill
A logical vector: TRUE if you want to use information about whether a respondent chose the same profile for the repeated task and "fill" (using the `tidyr` package) missing values for the non-repeated tasks, FALSE (otherwise). If the number of respondents is small, if the number of specific profile pairs of your interest is small, and/or if the number of specific respondent subgroups you want to study is small, it is worth changing this option to TRUE. But please note that `.fill = TRUE` is based on an assumption that IRR is independent of information contained in conjoint tables. Although our empirical tests suggest the validity of this assumption, if you are unsure about it, it is better to use the default value (FALSE).
Value
A projoint object of class projoint_data
ready to pass to projoint
.