-
Notifications
You must be signed in to change notification settings - Fork 0
/
data_luottamus.R
30 lines (25 loc) · 1.07 KB
/
data_luottamus.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## ------------------------------------ ##
## Datan käsittelyä ##
## ------------------------------------ ##
load("data/ess_luottamus.rda")
df <- ess_luottamus
library(plyr)
relevel_trust <- function(x) {
revalue(x, c("No trust at all"="0",
"Complete trust"="10"))
}
# luottamus-muuttujat
df$trstprl <- relevel_trust(df$trstprl)
df$trstlgl <- relevel_trust(df$trstlgl)
df$trstplc <- relevel_trust(df$trstplc)
df$trstplt <- relevel_trust(df$trstplt)
df$trstprt <- relevel_trust(df$trstprt)
df$trstep <- relevel_trust(df$trstep)
df$trstun <- relevel_trust(df$trstun)
# ladataan graafifunktio
df$ppltrst <- revalue(df$ppltrst, c("You can't be too careful"="0",
"Most people can be trusted"="10"))
df$pplfair <- revalue(df$pplfair, c("Most people try to take advantage of me"="0",
"Most people try to be fair"="10"))
df$pplhlp <- revalue(df$pplhlp, c("People mostly look out for themselves"="0",
"People mostly try to be helpful"="10"))