如何将联合数据从宽变长?
How to reshape conjoint data from wide to long?
用户,
我收到了联合调查实验的数据。我想要做的是从宽格式重塑为长格式。然而,这似乎有点复杂。我很确定可以使用 cj_tidy
(包 cregg
)但我自己无法解决。
在调查中,受访者被要求比较两个在 7 配置文件(效率 Opennes 包容 领导者 收获 & 系统 ).总共向受访者展示了四项比较。所以 2 个组织和 4 个比较 (4x2)。他们必须在所展示的组织中选择一个,并在选择一个后分别对其进行评分。
目前,配置文件变量的结构如下:org1_Efficiency_conj_1、org1_Opennes_conj1 ..等。第一部分“org”表示它是第一组织还是第二组织。最后一部分“conj”,表示conjoint/comparison的顺序,其中“conj4”是最后一个比较。 CHOICE 变量也遵循联合分析的顺序——例如,“CHOICE_conj1”、“CHOICE_conj2”,其中 =1 表示受访者选择了“org1”。如果 =2,则选择 org2。 RATING> 变量表示每个组织的 0 到 10 的值:RATING_conj1_org1; RATING_conj1_org2 等..
当前的宽格式数据不适合联合分析——我需要为每个受访者创建 8 个观察值 (4x2=8),其中变量 CHOICE指出选择了哪些组织(如果是,则 =1;如果否,则 =0)。以类似的方式,变量 RATING 应表示受访者对两个组织的评分(0 到 10)。
这就是我希望数据的样子:
请注意,图片中还有 Q1 和 Q2 等协变量,它们不是实验的一部分,应该对每个单独的观察保持不变。
下面我分享了我真实数据中的 50 个观察结果。
> dput(cjdata_wide) structure(list(ID = 1:50, org1_Effeciency_conj_1 =
> c(3L, 2L, 1L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 1L, 1L, 1L, 1L, 1L, 3L,
> 2L, 3L, 3L, 3L, 2L, 3L, 1L, 2L, 1L, 3L, 3L, 1L, 1L, 3L, 1L, 1L, 3L,
> 3L, 2L, 3L, 2L, 3L, 2L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 2L, 2L, 1L ),
> org1_Oppenes_conj_1 = c(3L, 3L, 1L, 3L, 1L, 3L, 2L, 3L, 2L, 3L, 1L,
> 1L, 1L, 2L, 3L, 2L, 2L, 1L, 3L,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5L, 5L, 5L, 2L, 5L, 5L,
> 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 1L, 5L, 5L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L ), educ = c(6L, 5L, 2L, 5L, 6L, 6L, 4L, 6L,
> 3L, 5L, 4L, 5L, 6L, 4L, 4L, 6L, 6L, 6L, 3L, 6L, 5L, 6L, 5L, 5L, 3L,
> 4L, 6L, 6L, 5L, 3L, 3L, 4L, 3L, 6L, 3L, 5L, 5L, 6L, 3L, 5L, 3L, 3L,
> 3L, 3L, 4L, 5L, 5L, 4L, 2L, 3L)), class = "data.frame", row.names =
> c(NA,
> -50L))
到目前为止我所做的是:
library(cregg)
str(long <- cj_tidy(cjdata_wide,
profile_variables = c("All the profile variables"),
task_variables = c("CHOICE AND RATING VARIABLES HERE"),
id = ~ id))
stopifnot(nrow(long) == nrow(data)*4*2
但我总是出错。我试图按照 cregg
包给出的示例进行操作 - 但没有成功。任何帮助深表感谢!我对所有可能的方式都持开放态度,例如通过 cregg 包或 tidyr
。
您的数据不是标准格式使这成为一个难题。这是使用 tidyr 包的解决方案。
解决方案包括 3 个部分,处理配置文件、评级以及最后的评级选择。
配置文件部分的关键是将配置文件名称拆分为多个组成部分,然后将列标题旋转得更宽。
评级和二元选择涉及旋转更长的时间然后对齐行。
library(tidyr)
library(dplyr)
#Get the categories part correct
answer <-cjdata_wide %>% pivot_longer(cols=starts_with("org"), names_to=c("org", "Cat", "conj", "order"), values_to= "values", names_sep="_") %>% select(-c("conj"))
answer <-answer %>% select(!starts_with("RATING") & !starts_with("CHOICE"))
answer <-pivot_wider(answer, names_from = "Cat", values_from = "values")
#get the ratings column corretn
rating <-cjdata_wide %>% select(starts_with("RATING") )
rating <- rating%>% pivot_longer(cols=everything(), names_to=c("Rating", "conj", "order"), values_to= "Choice_Rating", names_sep="_") %>% select(-c("conj"))
answer$Choice_Rating <- rating$Choice_Rating
#Get the choice correct
choice <-cjdata_wide %>% select(starts_with("CHOICE") )
choiceRate <- choice%>% pivot_longer(cols=everything(), names_to=c("Choice", "conj"), values_to= "Choice_Rating", names_sep="_") %>% select(-c("conj"))
answer$Choice_binary <-ifelse(substr(answer$org, 4,4) == rep(choiceRate$Choice_Rating,each=2), 1, 0)
answer
也许可以简化以上内容。祝你好运。
根据评论更新
最终数据框具有对应于组织 1 或 2 的行对。我复制了选择,以便 Choice_Rating 列与组织(“组织”列)的长度相同。然后我比较了 Choice_Rating & Organization 并根据匹配将最终值设置为 0 或 1。
对于评论中的问题,一种简单的方法是使用 as.integer()
函数将因子列转换为整数,然后第一个因子变为 1,第二个因子变为 2 等(可能需要重新调整以获得正确的顺序).
另一种选择是创建一个新的“组织”列,并正确列出您的因素名称。
希望这能提供足够的指导。
用户,
我收到了联合调查实验的数据。我想要做的是从宽格式重塑为长格式。然而,这似乎有点复杂。我很确定可以使用 cj_tidy
(包 cregg
)但我自己无法解决。
在调查中,受访者被要求比较两个在 7 配置文件(效率 Opennes 包容 领导者 收获 & 系统 ).总共向受访者展示了四项比较。所以 2 个组织和 4 个比较 (4x2)。他们必须在所展示的组织中选择一个,并在选择一个后分别对其进行评分。
目前,配置文件变量的结构如下:org1_Efficiency_conj_1、org1_Opennes_conj1 ..等。第一部分“org”表示它是第一组织还是第二组织。最后一部分“conj”,表示conjoint/comparison的顺序,其中“conj4”是最后一个比较。 CHOICE 变量也遵循联合分析的顺序——例如,“CHOICE_conj1”、“CHOICE_conj2”,其中 =1 表示受访者选择了“org1”。如果 =2,则选择 org2。 RATING> 变量表示每个组织的 0 到 10 的值:RATING_conj1_org1; RATING_conj1_org2 等..
当前的宽格式数据不适合联合分析——我需要为每个受访者创建 8 个观察值 (4x2=8),其中变量 CHOICE指出选择了哪些组织(如果是,则 =1;如果否,则 =0)。以类似的方式,变量 RATING 应表示受访者对两个组织的评分(0 到 10)。
这就是我希望数据的样子:
请注意,图片中还有 Q1 和 Q2 等协变量,它们不是实验的一部分,应该对每个单独的观察保持不变。
下面我分享了我真实数据中的 50 个观察结果。
> dput(cjdata_wide) structure(list(ID = 1:50, org1_Effeciency_conj_1 =
> c(3L, 2L, 1L, 3L, 3L, 2L, 3L, 3L, 3L, 3L, 2L, 1L, 1L, 1L, 1L, 1L, 3L,
> 2L, 3L, 3L, 3L, 2L, 3L, 1L, 2L, 1L, 3L, 3L, 1L, 1L, 3L, 1L, 1L, 3L,
> 3L, 2L, 3L, 2L, 3L, 2L, 1L, 1L, 3L, 2L, 1L, 1L, 1L, 2L, 2L, 1L ),
> org1_Oppenes_conj_1 = c(3L, 3L, 1L, 3L, 1L, 3L, 2L, 3L, 2L, 3L, 1L,
> 1L, 1L, 2L, 3L, 2L, 2L, 1L, 3L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 1L, 3L,
> 1L, 2L, 2L, 3L, 2L, 2L, 1L, 3L, 1L, 3L, 2L, 2L, 1L, 2L, 3L, 3L, 3L,
> 3L, 3L, 2L, 3L, 1L), org1_Inclusion_conj_1 = c(2L, 1L, 1L, 2L, 2L,
> 2L, 1L, 1L, 2L, 2L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L,
> 1L, 2L, 1L, 1L, 1L, 2L, 1L, 1L, 2L, 1L, 2L), org1_Leader_conj_1 =
> c(5L, 6L, 3L, 6L, 1L, 4L, 2L, 6L, 1L, 6L, 1L, 2L, 2L, 6L, 3L, 2L, 6L,
> 3L, 5L, 6L, 3L, 1L, 4L, 3L, 5L, 5L, 2L, 1L, 4L, 1L, 3L, 4L, 2L, 3L,
> 5L, 2L, 1L, 3L, 3L, 2L, 1L, 4L, 1L, 5L, 2L, 6L, 1L, 4L, 2L, 3L),
> org1_Gain_conj_1 = c(4L, 4L, 1L, 3L, 3L, 8L, 3L, 2L, 6L, 5L, 1L, 6L,
> 3L, 8L, 1L, 3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> 1L, 1L, 3L, 3L, 2L, 3L, 3L, 2L, 1L, 3L, 3L, 3L, 977L, 1L, 3L, 977L,
> 977L, 1L), gender = c(1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 2L, 1L,
> 1L, 2L, 2L, 1L, 1L, 2L, 1L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 2L,
> 1L, 1L, 2L, 1L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 2L,
> 1L, 2L, 2L, 1L), profile_age = c(5L, 2L, 5L, 5L, 3L, 5L, 2L, 5L, 3L,
> 5L, 3L, 3L, 5L, 5L, 5L, 5L, 5L, 5L, 2L, 5L, 5L, 5L, 5L, 2L, 5L, 5L,
> 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 1L, 5L, 5L, 1L, 1L, 1L, 1L, 1L,
> 1L, 1L, 1L, 1L, 1L, 1L, 1L ), educ = c(6L, 5L, 2L, 5L, 6L, 6L, 4L, 6L,
> 3L, 5L, 4L, 5L, 6L, 4L, 4L, 6L, 6L, 6L, 3L, 6L, 5L, 6L, 5L, 5L, 3L,
> 4L, 6L, 6L, 5L, 3L, 3L, 4L, 3L, 6L, 3L, 5L, 5L, 6L, 3L, 5L, 3L, 3L,
> 3L, 3L, 4L, 5L, 5L, 4L, 2L, 3L)), class = "data.frame", row.names =
> c(NA,
> -50L))
到目前为止我所做的是:
library(cregg)
str(long <- cj_tidy(cjdata_wide,
profile_variables = c("All the profile variables"),
task_variables = c("CHOICE AND RATING VARIABLES HERE"),
id = ~ id))
stopifnot(nrow(long) == nrow(data)*4*2
但我总是出错。我试图按照 cregg
包给出的示例进行操作 - 但没有成功。任何帮助深表感谢!我对所有可能的方式都持开放态度,例如通过 cregg 包或 tidyr
。
您的数据不是标准格式使这成为一个难题。这是使用 tidyr 包的解决方案。
解决方案包括 3 个部分,处理配置文件、评级以及最后的评级选择。
配置文件部分的关键是将配置文件名称拆分为多个组成部分,然后将列标题旋转得更宽。
评级和二元选择涉及旋转更长的时间然后对齐行。
library(tidyr)
library(dplyr)
#Get the categories part correct
answer <-cjdata_wide %>% pivot_longer(cols=starts_with("org"), names_to=c("org", "Cat", "conj", "order"), values_to= "values", names_sep="_") %>% select(-c("conj"))
answer <-answer %>% select(!starts_with("RATING") & !starts_with("CHOICE"))
answer <-pivot_wider(answer, names_from = "Cat", values_from = "values")
#get the ratings column corretn
rating <-cjdata_wide %>% select(starts_with("RATING") )
rating <- rating%>% pivot_longer(cols=everything(), names_to=c("Rating", "conj", "order"), values_to= "Choice_Rating", names_sep="_") %>% select(-c("conj"))
answer$Choice_Rating <- rating$Choice_Rating
#Get the choice correct
choice <-cjdata_wide %>% select(starts_with("CHOICE") )
choiceRate <- choice%>% pivot_longer(cols=everything(), names_to=c("Choice", "conj"), values_to= "Choice_Rating", names_sep="_") %>% select(-c("conj"))
answer$Choice_binary <-ifelse(substr(answer$org, 4,4) == rep(choiceRate$Choice_Rating,each=2), 1, 0)
answer
也许可以简化以上内容。祝你好运。
根据评论更新
最终数据框具有对应于组织 1 或 2 的行对。我复制了选择,以便 Choice_Rating 列与组织(“组织”列)的长度相同。然后我比较了 Choice_Rating & Organization 并根据匹配将最终值设置为 0 或 1。
对于评论中的问题,一种简单的方法是使用 as.integer()
函数将因子列转换为整数,然后第一个因子变为 1,第二个因子变为 2 等(可能需要重新调整以获得正确的顺序).
另一种选择是创建一个新的“组织”列,并正确列出您的因素名称。
希望这能提供足够的指导。