在R

时间:2019-07-18 18:14:49

标签: r dataset survey

我有一些调查数据用来衡量信任度,每个国家/地区的每个受访者回答“倾向于信任”,“倾向于不信任”或“不知道”。

数据是时间序列的,跨国家的,我想对其进行转换,因此每年每个变量都有一个数值。

我已经下载了SPSS格式的数据,并使用read.spss函数将其放入R中,但是现在我对如何更改它感到困惑。

我在下面有一个用于网络信任的公式,但不知道在R中需要什么命令或软件包。

“净信任=信任/(信任+不信任+不知道)-不信任/(信任+不信任+不知道)”

很抱歉,如果以前已经发布过此问题,但我真的很感谢您的一些建议。

干杯!

structure(list(qb1_2 = structure(c(2L, 3L, 1L, 2L, 2L, 2L, 3L, 
2L, 1L, 2L), .Label = c("Totally agree", "Tend to agree", "Tend to        disagree"
), class = "factor"), qb1_3 = structure(c(2L, 4L, 1L, 2L, 2L, 
2L, 3L, 3L, 1L, 1L), .Label = c("Totally agree", "Tend to agree", 
"Tend to disagree", "Totally disagree"), class = "factor"), qb1_4 = structure(c(2L, 
    3L, 1L, 1L, 2L, 2L, 2L, 2L, 1L, 1L), .Label = c("Totally agree", 
   "Tend to agree", "Tend to disagree"), class = "factor"), qb2_1 =   structure(c(2L, 
    2L, 1L, 1L, 2L, 2L, 2L, 3L, 1L, 1L), .Label = c("Very important", 
    "Fairly important", "Not very important"), class = "factor"), 
    qb2_2 = structure(c(2L, 1L, 1L, 1L, 2L, 2L, 1L, 2L, 1L, 1L
    ), .Label = c("Very important", "Fairly important"), class = "factor"), 
    qb2_3 = structure(c(1L, 2L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L
    ), .Label = c("Very important", "Fairly important"), class = "factor"), 
    qb2_4 = structure(c(1L, 1L, 1L, 1L, 2L, 2L, 1L, 3L, 1L, 1L
    ), .Label = c("Very important", "Fairly important", "Not very important"
    ), class = "factor"), qb2_5 = structure(c(2L, 2L, 1L, 3L, 
    2L, 2L, 2L, 1L, 1L, 2L), .Label = c("Very important", "Fairly important", 
    "Not very important"), class = "factor"), qb3_1 = structure(c(2L, 
    4L, 1L, 3L, 3L, 2L, 3L, 2L, 3L, 3L), .Label = c("Totally agree", 
    "Tend to agree", "Tend to disagree", "Totally disagree"), class = "factor"), 
    qb3_2 = structure(c(2L, 3L, 1L, 2L, 3L, 2L, 2L, 2L, 3L, 3L
    ), .Label = c("Totally agree", "Tend to agree", "Tend to disagree"
    ), class = "factor"), qb3_3 = structure(c(2L, 3L, 1L, 2L, 
    2L, 2L, 3L, 2L, 2L, 1L), .Label = c("Totally agree", "Tend to agree", 
    "Tend to disagree"), class = "factor"), qb3_4 = structure(c(2L, 
    2L, 1L, 4L, 2L, 2L, 3L, 1L, 3L, 2L), .Label = c("Totally agree", 
    "Tend to agree", "Tend to disagree", "Totally disagree"), class = "factor"), 
    qb3_5 = structure(c(2L, 4L, 1L, 3L, 2L, 2L, 2L, 2L, 3L, 2L
    ), .Label = c("Totally agree", "Tend to agree", "Tend to disagree", 
    "Totally disagree"), class = "factor"), qb3_6 = structure(c(2L, 
    4L, 1L, 5L, 3L, 2L, 3L, 1L, 3L, 3L), .Label = c("Totally agree", 
    "Tend to agree", "Tend to disagree", "Totally disagree", 
    "DK"), class = "factor"), qb3_7 = structure(c(2L, 4L, 1L, 
    3L, 3L, 2L, 2L, 5L, 3L, 2L), .Label = c("Totally agree", 
    "Tend to agree", "Tend to disagree", "Totally disagree", 
    "DK"), class = "factor"), qb4_1 = structure(c(2L, 3L, 1L, 
    3L, 2L, 2L, 2L, 2L, 3L, 2L), .Label = c("Totally agree", 
    "Tend to agree", "Tend to disagree"), class = "factor"), 
    qb4_2 = structure(c(1L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 1L
    ), .Label = c("Totally agree", "Tend to agree"), class = "factor"), 
    qb5 = structure(c(2L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("On a case by case basis", 
    "Always, in every case"), class = "factor"), qb6.1 = structure(c(2L, 
    2L, NA, 2L, 2L, NA, 2L, 1L, 2L, 2L), .Label = c("Not mentioned", 
    "Mentioned"), class = "factor"), qb6.2 = structure(c(2L, 
    2L, NA, 1L, 2L, NA, 1L, 1L, 2L, 1L), .Label = c("Not mentioned", 
    "Mentioned"), class = "factor"), qb6.3 = structure(c(2L, 
    1L, NA, 2L, 2L, NA, 1L, 2L, 2L, 1L), .Label = c("Not mentioned", 
    "Mentioned"), class = "factor")), .Names = c("qb1_2", "qb1_3", 
"qb1_4", "qb2_1", "qb2_2", "qb2_3", "qb2_4", "qb2_5", "qb3_1", 
"qb3_2", "qb3_3", "qb3_4", "qb3_5", "qb3_6", "qb3_7", "qb4_1", 
"qb4_2", "qb5", "qb6.1", "qb6.2", "qb6.3"), row.names = c(NA, 
10L), class = "data.frame")

0 个答案:

没有答案