-
Notifications
You must be signed in to change notification settings - Fork 0
/
misc_routines.R
22 lines (15 loc) · 1.23 KB
/
misc_routines.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
### Try to divide different groups of people based on the family structure and origin
fam.Austrian <- master %>% filter(ftype=="Yes, with children." & Austrian!="No")
fam.EU <- master %>% filter(ftype=="Yes, with children." & EU.citizen!="No")
fam.non.EU <- master %>% filter(ftype=="Yes, with children." & EU.citizen=="No")
noKid.Austrian <- master %>% filter(ftype=="Yes, I cohabit with a partner or other family members." & Austrian!="No")
noKid.EU <- master %>% filter(ftype=="Yes, I cohabit with a partner or other family members." & EU.citizen!="No")
noKid.non.EU <- master %>% filter(ftype=="Yes, I cohabit with a partner or other family members." & EU.citizen=="No")
mults1 <- master %>% select(id, ends_with("mult")) %>% unnest_(mult.vars[1])
mults1 <- master %>% select(id, ends_with("mult")) %>% unnest(german.reason.mult)
mults1 <- master %>% select(id, ends_with("mult")) %>% unnest(circle.mult)
mults1 <- master %>% select(id, ends_with("mult")) %>% unnest(barrier.mult)
mults <- mults %>%
mutate(ord=factor(circle.mult, levels=names(table(circle.mult))[order(table(circle.mult), decreasing=TRUE)], labels=1:length(table(circle.mult)))) %>%
mutate(ord=paste0("circle", str_pad(ord, 2, pad="0"))) %>%
spread(ord, circle.mult)