-
Notifications
You must be signed in to change notification settings - Fork 0
/
amonth.Rmd
96 lines (50 loc) · 1.65 KB
/
amonth.Rmd
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
title: "create_amonth"
output: word_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown for creating amonth and key/key_nis
```{r}
library(haven);library(tidyverse);library(survey)
```
```{r read core dataframes into the document}
#2007
c07 <- read_stata("F:/NIS_2007_Core.dta")
a07 <- c07 %>% select(KEY, AMONTH)
names(a07) <- tolower(names(a07))
write_csv(a07, "H:/bita_nis/df/a07.csv")
#2008
c08 <- read_stata("F:/NIS_2008_Core.dta")
a08 <- c08 %>% select(KEY, AMONTH)
write_csv(a08, "H:/bita_nis/df/a08.csv")
#2009
c09 <- read_stata("H:/NIS_2009_Core.dta")
a09 <- c09 %>% select(KEY, AMONTH)
write_csv(a09, "H:/bita_nis/a09.csv")
#2010
c10 <- read_stata("E:/NIS_DATA/nis_material/nis_data/nis2010/NIS_2010_Core.dta")
a10 <- c10 %>% select(KEY, AMONTH)
write_csv(a10, "H:/bita_nis/a10.csv")
#2011
c11 <- read_stata("E:/NIS_DATA/nis_material/nis_data/nis2011/NIS_2011_Core.dta")
a11 <- c11 %>% select(KEY, AMONTH)
write_csv(a11, "H:/bita_nis/a11.csv")
#2012
c12 <- read_stata("E:/NIS_DATA/nis_material/nis_data/nis2012/NIS_2012_Core.dta")
a12 <- c12 %>% select(KEY_NIS,AMONTH)
write_csv(a12, "H:/bita_nis/a12.csv")
#2013
c13 <- read_stata("F:/NIS_2013_Core.dta")
a13 <- c13 %>% select(KEY_NIS, AMONTH)
write_csv(a13, "H:/bita_nis/a13.csv")
#2014
c14 <- read_spss("G:/NIS_2014_Core.sav")
a14 <- c14 %>% select(KEY_NIS, AMONTH)
write_csv(a14, "H:/bita_nis/a14.csv")
#2015 q3
c15 <- read_stata("G:/NIS_2015_Core.dta")
a15 <- c15 %>% select(KEY_NIS,AMONTH)
write_csv(a15, "H:/bita_nis/a15.csv")
```