我正在处理有关暗杀企图的数据。我必须找到领导者生存的国家的平均基线政治得分 那些没有的人。
数据集如下:
"year","country","leadername","age","politybefore","polityafter","interwarbefore","interwarafter","civilwarbefore","civilwarafter","result"
1929,"Afghanistan","Habibullah Ghazi",39,-6,-6,0,0,1,0,"not wounded"
我认为我要做的是创建两个数据子集,一个成功的尝试和一个不成功的尝试,然后找到"politybefore"
列的平均值,但我不知道最有效的方法。
结果的选项是:
levels(leaders$result)
[1] "dies between a day and a week"
[2] "dies between a week and a month"
[3] "dies within a day after the attack"
[4] "dies, timing unknown"
[5] "hospitalization but no permanent disability"
[6] "not wounded"
[7] "plot stopped"
[8] "survives but wounded severely"
[9] "survives, whether wounded unknown"
[10] "wounded lightly"

因此导致死亡的任何事情都是成功的。