我进行了联合设计调查,希望使用cjoint package。来自cjoint包的示例数据格式为:
head(model)
CaseID contest_no FeatEd FeatJob
1 4 1 high school Nurse
2 4 1 no formal Child care provider
3 4 2 graduate degree Gardener
4 4 2 4th grade Construction worker
5 4 3 high school Nurse
6 4 3 college degree Child care provider
FeatLang Chosen_Immigrant
1 tried English but unable Yes
2 used interpreter No
3 fluent English No
4 fluent English Yes
5 broken English Yes
6 fluent English No
"案例ID"代表每个受访者," contest_no"是每个受访者完成的个人任务。在这种情况下,每个受访者完成了5个任务(任务1到3可见),每个任务比较2个配置文件。每个配置文件都根据属性" FeatEd"," Featjob"," FeatLang"而变化。所选的配置文件列为" Chosen_Immigrant",带有是或否的指示符。
我目前的数据是:
例如:
has[1:3,12:16]
F.1.1
1 Affordability
2 Community Support
3 Height
F.1.1.1
1 Affordable units will be built off-site, elsewhere in the city.
2 Most people in the community support it.
3 3 stories
F.1.2 F.1.1.2 F.1.3
1 Party Support Local Republican Party supports it. Community Support
2 Parking All residents will park on the street. Affordability
3 Location In your neighborhood Affordability
F.1.1代表任务1的属性标题.F.1.1.1是配置文件1的任务1的属性值.F.1.2.1(未显示)是配置文件2的任务1的属性值F.1.2。任务1,属性2的标题.F.1.1.2是配置文件1的任务2的属性值。依此类推......
据我了解,为了将我的数据框与cjoint示例的数据框匹配,我需要:
我想我可以用reshape2或tidyr找出第3步。但是,任何有关按行给定单元格值排序并抓取行中相关其他单元格的帮助都将非常受欢迎。