-
Notifications
You must be signed in to change notification settings - Fork 0
/
ukb_test.R
2568 lines (2059 loc) · 99.5 KB
/
ukb_test.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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
library(tidyverse)
library(lubridate)
library(data.table) #可以多线程
library(VIM)
library(mice)
library(job)
setwd("~/Desktop/ukb") #读取wd路径
load("~/Desktop/ukb/ukb_test.RData") #读取环境
save.image("~/Desktop/ukb/ukb_test.RData") #保存环境
#读取文件并显示所用时间
time.start <- Sys.time()
job::job(title = "raw1",{
ukb_test <- as.data.frame(read_csv("/Users/wanjiang/Desktop/ukb/ukb_data/ukb_test.csv"))
})
job::job(title = "raw2",{
ukb_raw2 <- as.data.frame(read_csv("/Users/wanjiang/Desktop/ukb/ukb_data/ukb51584.csv"))
})
job::job(title = "raw3",{
ukb_raw3 <- as.data.frame(read_csv("/Users/wanjiang/Desktop/ukb/ukb_data/ukb668900.csv"))
})
time.end <- Sys.time()
time.running <- time.end-time.start
print(time.running)
rm(time.start,time.end,time.running)
ukb_test <- ukb_test[,-1] #原有18293列,去除第一列编号,剩18292列
#查看ukb_test
head(ukb_test)
#------1. 寻找变量------
#有些变量在提取时可以用 starts_with()
ukb_apply <- ukb_test %>%
select(
##----1.1 编号、年龄、性别等----
'eid',#id 编码
'53-0.0',# Date of attending assessment centre 注册时间
'53-1.0',
'53-2.0',
'53-3.0',
'34-0.0',#Year of birth 出生年份
'52-0.0',#month of birth 出生月份
'20022-0.0',#Birth weight 出生体重
'31-0.0', #sex
'21022-0.0',# age at recruitment
'102-0.0',#Pulse rate 脉搏率
'4194-0.0',#Pulse rate 心率
##--1.2 血压----
'4079-0.0',#Diastolic blood pressure DBP
'4079-0.1',
'4079-1.0',
'4079-1.1',
'4079-2.0',
'4079-2.1',
'4079-3.0',
'4079-3.1',
'4080-0.0',#Systolic blood pressure SBP
'4080-0.1',
'4080-1.0',
'4080-1.1',
'4080-2.0',
'4080-2.1',
'4080-3.0',
'4080-3.1',
##----1.3 身高、体重和BMI----
'21001-0.0',#Body mass index BMI
'21001-1.0',
'21001-2.0',
'21001-3.0',
'23098-0.0',#Weight 体重
'21002-0.0',#Weight 体重
'50-0.0',#standing height站高
'48-0.0',#waist circumference 腰围
'49-0.0',#hip circumference 臀围
##----1.4 种族----
'21000-0.0',#Ethnic background 种族
'21000-1.0',
'21000-2.0',
##----1.5 教育----
'6138-0.0', #Qualifications 教育 code:100305
'6138-0.1',
'6138-0.2',
'6138-0.3',
'6138-0.4',
'6138-0.5',
'6138-1.0',
'6138-1.1',
'6138-1.2',
'6138-1.3',
'6138-1.4',
'6138-1.5',
'6138-2.0',
'6138-2.1',
'6138-2.2',
'6138-2.3',
'6138-2.4',
'6138-2.5',
'6138-3.0',
'6138-3.1',
'6138-3.2',
'6138-3.3',
'6138-3.4',
'6138-3.5',
'10722-0.0',# Qualifications (pilot) 教育(飞行员?)code:10658
'10722-0.1',
'10722-0.2',
'10722-0.3',
'10722-0.4',
##-----1.6 diet部分-------
#水果
'1309-0.0', # Fresh fruit intake 新鲜水果
'1309-1.0',
'1309-2.0',
'1309-3.0',
'1319-0.0', # Dried fruit intake 干果
'1319-1.0',
'1319-2.0',
'1319-3.0',
#蔬菜
'1289-0.0', # Cooked vegetable intake 熟蔬菜
'1289-1.0',
'1289-2.0',
'1289-3.0',
'1299-0.0', # Salad / raw vegetable intake 生蔬菜
'1299-1.0',
'1299-2.0',
'1299-3.0',
#全谷物/精制谷物
'1438-0.0', # Bread intake 面包
'1438-1.0',
'1438-2.0',
'1438-3.0',
'1448-0.0', # Bread type 面包类型
'1448-1.0',
'1448-2.0',
'1448-3.0',
'1458-0.0', # Cereal intake 麦片
'1458-1.0',
'1458-2.0',
'1458-3.0',
'1468-0.0', # Cereal type 麦片类型
'1468-1.0',
'1468-2.0',
'1468-3.0',
#鱼
'1329-0.0', # Oily fish intake 油性鱼
'1329-1.0',
'1329-2.0',
'1329-3.0',
'1339-0.0', # Non-oily fish intake 非油性鱼
'1339-1.0',
'1339-2.0',
'1339-3.0',
#奶制品
'1408-0.0', # Cheese intake 奶酪
'1408-1.0',
'1408-2.0',
'1408-3.0',
'1418-0.0', # Milk type used 牛奶类型
'1418-1.0',
'1418-2.0',
'1418-3.0',
#肉类
'1349-0.0', # Processed meat intake 加工肉类
'1349-1.0',
'1349-2.0',
'1349-3.0',
'3680-0.0', # Age when last ate meat 上次吃肉的年龄
'3680-1.0',
'3680-2.0',
'3680-3.0',
'1359-0.0', # Poultry intake 家禽
'1359-1.0',
'1359-2.0',
'1359-3.0',
'1369-0.0', # Beef intake 牛肉
'1369-1.0',
'1369-2.0',
'1369-3.0',
'1379-0.0', # Lamb/mutton intake 羊肉
'1379-1.0',
'1379-2.0',
'1379-3.0',
'1389-0.0', # Pork intake 猪肉
'1389-1.0',
'1389-2.0',
'1389-3.0',
#加糖饮料
'6144-0.0', # Never eat eggs, dairy, wheat, sugar 从不吃蛋、奶、小麦、糖?
'6144-1.0',
'6144-2.0',
'6144-3.0',
"2654-0.0",# non_butter spread type details
"2654-1.0",
"2654-2.0",
"2654-3.0",
'1428-0.0', # Spread type 涂酱类型
'1428-1.0',
'1428-2.0',
'1428-3.0',
####------暂时未用到的 饮食
# '10855-0.0', # Never eat eggs, dairy, wheat, sugar (pilot) 从不吃蛋、奶、小麦、糖?飞行员
# '10767-0.0', # Spread type (pilot) 涂酱类型(飞行员)
# '10776-0.0', # Bread type/intake (pilot) 面包类型/摄入
# '1478-0.0', # Salt added to food 添加盐
# '1488-0.0', # Tea intake 茶
# '1498-0.0', # Coffee intake 咖啡
# '1508-0.0', # Coffee type 咖啡类型
# '1518-0.0', # Hot drink temperature 热饮温度
# '1528-0.0', # Water intake 水
# '1538-0.0', # Major dietary changes in the last 5 years 过去五年的主要饮食变化
# '1548-0.0', # Variation in diet 饮食变化
# '10912-0.0', # Variation in diet (pilot) 饮食变化(飞行员)
##----1.7 体力活动----
'22032-0.0',#IPAQ
'22037-0.0',#met_walking
'22038-0.0',#met_moderate
'22039-0.0',#met_vigorous
##----1.8 睡眠----
'1160-0.0',#Sleep duration 睡眠时间
'1160-1.0',
'1160-2.0',
'1160-3.0',
'1170-0.0',#Getting up in morning 早起难易程度
##----1.9 吸烟情况----
'1239-0.0',#Current tobacco smoking 当前吸烟情况
'1239-1.0',
'1239-2.0',
'1239-3.0',
'1249-0.0',#Past tobacco smoking 过去吸烟情况
'1249-1.0',
'1249-2.0',
'1249-3.0',
'2644-0.0',#吸过至少100支烟
'2644-1.0',
'2644-2.0',
'2644-3.0',
'20116-0.0',#Smoking status 吸烟状态 "-3:Prefer not to answer 0:Never 1:Previous 2 Current"
'20116-1.0',
'20116-2.0',
'20116-3.0',
##----1.10 饮酒情况----
'20414-0.0', #Frequency of drinking alcohol code:521
'100580-0.0', #alcohol consumed code:100010
'100580-1.0',
'100580-2.0',
'100580-3.0',
'100580-4.0',
'100590-0.0', #red wine code:100006
'100590-1.0',
'100590-2.0',
'100590-3.0',
'100590-4.0',
'100630-0.0', #rose wine
'100630-1.0',
'100630-2.0',
'100630-3.0',
'100630-4.0',
'100670-0.0', #white wine
'100670-1.0',
'100670-2.0',
'100670-3.0',
'100670-4.0',
'100710-0.0', #beer/cider
'100710-1.0',
'100710-2.0',
'100710-3.0',
'100710-4.0',
'100720-0.0', #fortified wine
'100720-1.0',
'100720-2.0',
'100720-3.0',
'100720-4.0',
'100730-0.0', #spirits
'100730-1.0',
'100730-2.0',
'100730-3.0',
'100730-4.0',
'100740-0.0', #other alcohol
'100740-1.0',
'100740-2.0',
'100740-3.0',
'100740-4.0',
'20117-0.0',#Alcohol drinker status 饮酒状态"-3:Prefer not to answer 0:Never 1:Previous 2 Current"
'20117-1.0',
'20117-2.0',
'20117-3.0',
##----1.11 工作----
'20119-0.0',#Current employment status - corrected 就业状态
'6142-0.0', #current employment status
'6142-0.1',
'6142-0.2',
'6142-0.3',
'6142-0.4',
'6142-0.5',
'6142-0.6',
'6142-1.0',
'6142-1.1',
'6142-1.2',
'6142-1.3',
'6142-1.4',
'6142-1.5',
'6142-1.6',
'6142-2.0',
'6142-2.1',
'6142-2.2',
'6142-2.3',
'6142-2.4',
'6142-2.5',
'6142-2.6',
'6142-3.0',
'6142-3.1',
'6142-3.2',
'6142-3.3',
'6142-3.4',
'6142-3.5',
'6142-3.6',
##----1.12 家庭收入----
'738-0.0', #平均税前家庭总收入 code :100294
'738-1.0',
'738-2.0',
'738-3.0',
'10877-0.0',# 平均税前家庭总收入(pilot) code :100657
##----1.13 实验室指标----
'30630-0.0',#载脂蛋白A
'30630-1.0',#
'30640-0.0',#载脂蛋白B
'30640-1.0',
'30690-0.0',#胆固醇
'30690-1.0',
'30870-0.0',#TC-甘油三酯
'30870-1.0',
'30760-0.0',#HDL
'30760-1.0',
'30780-0.0',#LDL
'30780-1.0',
'30790-0.0',#脂蛋白A
'30790-1.0',
'30740-0.0',#血糖1
'30740-1.0',#血糖2
'30750-0.0',#糖化血红蛋白1
'30750-1.0',#糖化血红蛋白2
'30700-0.0',#肌酐
'30710-0.0',#C反应蛋白
'30730-0.0',#γ-谷氨酰转移酶
'30800-0.0',#雌二醇
'30810-0.0',#磷酸盐
'30820-0.0',#类风湿因子
'30830-0.0',#SHBG-性激素结合球蛋白
'30840-0.0',#总胆红素
'30850-0.0',#睾酮
'30860-0.0',#总蛋白
'30880-0.0',#尿酸盐
'30890-0.0',#Vitamin D
##----1.14 用药情况----
'6153-0.0',#Medication for cholesterol, blood pressure, diabetes, or take exogenous hormones 治疗胆固醇、血压、糖尿病、或服用外源性激素的药物
'6153-0.1',
'6153-0.2',
'6153-0.3',
'6153-1.0',
'6153-1.1',
'6153-1.2',
'6153-1.3',
'6153-2.0',
'6153-2.1',
'6153-2.2',
'6153-2.3',
'6153-3.0',
'6153-3.1',
'6153-3.2',
'6153-3.3',
'6177-0.0',#Medication for cholesterol, blood pressure or diabetes 治疗胆固醇、血压或糖尿病的药物
'6177-0.1',
'6177-0.2',
'6177-1.0',
'6177-1.1',
'6177-1.2',
'6177-2.0',
'6177-2.1',
'6177-2.2',
'6177-3.0',
'6177-3.1',
'6177-3.2',
'20003-0.0',#Treatment/medication code 治疗、药物编码:4
##----1.15 糖尿病诊断----
'2443-0.0',#Diabetes diagnosed by doctor 糖尿病诊断
'2443-1.0',
'2443-2.0',
'2443-3.0',
##----1.16 自报的癌症----
#medical conditions
'20001-0.0', # cancer code, self reported
'20001-0.1',
'20001-0.2',
'20001-0.3',
'20001-0.4',
'20001-0.5',
'20001-1.0', # 1
'20001-1.1',
'20001-1.2',
'20001-1.3',
'20001-1.4',
'20001-1.5',
'20001-2.0', # 2
'20001-2.1',
'20001-2.2',
'20001-2.3',
'20001-2.4',
'20001-2.5',
'20001-3.0', # 3
'20001-3.1',
'20001-3.2',
'20001-3.3',
'20001-3.4',
'20001-3.5',
'134-0.0', #number of self-reported cancers
'134-1.0',
'134-2.0',
'134-3.0',
##----1.17 自报的非癌疾病----
#non-cancer illness code, self reported
'20002-0.0','20002-0.1','20002-0.2','20002-0.3','20002-0.4','20002-0.5','20002-0.6','20002-0.7','20002-0.8','20002-0.9',
'20002-0.10','20002-0.11','20002-0.12','20002-0.13','20002-0.14','20002-0.15','20002-0.16','20002-0.17','20002-0.18','20002-0.19',
'20002-0.20','20002-0.21','20002-0.22','20002-0.23','20002-0.24','20002-0.25','20002-0.26','20002-0.27','20002-0.28','20002-0.29',
'20002-0.30','20002-0.31','20002-0.32','20002-0.33',
'20002-1.0','20002-1.1','20002-1.2','20002-1.3','20002-1.4','20002-1.5','20002-1.6','20002-1.7','20002-1.8','20002-1.9',
'20002-1.10','20002-1.11','20002-1.12','20002-1.13','20002-1.14','20002-1.15','20002-1.16','20002-1.17','20002-1.18','20002-1.19',
'20002-1.20','20002-1.21','20002-1.22','20002-1.23','20002-1.24','20002-1.25','20002-1.26','20002-1.27','20002-1.28','20002-1.29',
'20002-1.30','20002-1.31','20002-1.32','20002-1.33',
'20002-2.0','20002-2.1','20002-2.2','20002-2.3','20002-2.4','20002-2.5','20002-2.6','20002-2.7','20002-2.8','20002-2.9',
'20002-2.10','20002-2.11','20002-2.12','20002-2.13','20002-2.14','20002-2.15','20002-2.16','20002-2.17','20002-2.18','20002-2.19',
'20002-2.20','20002-2.21','20002-2.22','20002-2.23','20002-2.24','20002-2.25','20002-2.26','20002-2.27','20002-2.28','20002-2.29',
'20002-2.30','20002-2.31','20002-2.32','20002-2.33',
'20002-3.0','20002-3.1','20002-3.2','20002-3.3','20002-3.4','20002-3.5','20002-3.6','20002-3.7','20002-3.8','20002-3.9',
'20002-3.10','20002-3.11','20002-3.12','20002-3.13','20002-3.14','20002-3.15','20002-3.16','20002-3.17','20002-3.18','20002-3.19',
'20002-3.20','20002-3.21','20002-3.22','20002-3.23','20002-3.24','20002-3.25','20002-3.26','20002-3.27','20002-3.28','20002-3.29',
'20002-3.30','20002-3.31','20002-3.32','20002-3.33',
'135-0.0', #number of self-reported non-cancer illnesses
'135-1.0',
'135-2.0',
'135-3.0',
# '84-0.0', #cancer year/age first occurred
# '84-0.1',
# '84-0.2',
# '84-0.3',
# '84-0.4',
# '84-0.5',
# '84-1.0', #1
# '84-1.1',
# '84-1.2',
# '84-1.3',
# '84-1.4',
# '84-1.5',
# '84-2.0', #2
# '84-2.1',
# '84-2.2',
# '84-2.3',
# '84-2.4',
# '84-2.5',
# '84-2.0', #3
# '84-3.1',
# '84-3.2',
# '84-3.3',
# '84-3.4',
# '84-3.5',
# # Non-cancer illness year/age first occurred
# '87-0.0','87-0.1','87-0.2','87-0.3','87-0.4','87-0.5','87-0.6','87-0.7','87-0.8','87-0.9',
# '87-0.10','87-0.11','87-0.12','87-0.13','87-0.14','87-0.15','87-0.16','87-0.17','87-0.18','87-0.19',
# '87-0.20','87-0.21','87-0.22','87-0.23','87-0.24','87-0.25','87-0.26','87-0.27','87-0.28','87-0.29',
# '87-0.30','87-0.31','87-0.32','87-0.33',
#
# '87-1.0','87-1.1','87-1.2','87-1.3','87-1.4','87-1.5','87-1.6','87-1.7','87-1.8','87-1.9',
# '87-1.10','87-1.11','87-1.12','87-1.13','87-1.14','87-1.15','87-1.16','87-1.17','87-1.18','87-1.19',
# '87-1.20','87-1.21','87-1.22','87-1.23','87-1.24','87-1.25','87-1.26','87-1.27','87-1.28','87-1.29',
# '87-1.30','87-1.31','87-1.32','87-1.33',
#
# '87-2.0','87-2.1','87-2.2','87-2.3','87-2.4','87-2.5','87-2.6','87-2.7','87-2.8','87-2.9',
# '87-2.10','87-2.11','87-2.12','87-2.13','87-2.14','87-2.15','87-2.16','87-2.17','87-2.18','87-2.19',
# '87-2.20','87-2.21','87-2.22','87-2.23','87-2.24','87-2.25','87-2.26','87-2.27','87-2.28','87-2.29',
# '87-2.30','87-2.31','87-2.32','87-2.33',
#
# '87-3.0','87-3.1','87-3.2','87-3.3','87-3.4','87-3.5','87-3.6','87-3.7','87-3.8','87-3.9',
# '87-3.10','87-3.11','87-3.12','87-3.13','87-3.14','87-3.15','87-3.16','87-3.17','87-3.18','87-3.19',
# '87-3.20','87-3.21','87-3.22','87-3.23','87-3.24','87-3.25','87-3.26','87-3.27','87-3.28','87-3.29',
# '87-3.30','87-3.31','87-3.32','87-3.33',
##----1.18 家族史----
# "20112-0.0",# Illnesses of adopted father 0-3*0-6
# "20113-0.0",# Illnesses of adopted mother
# "20114-0.0",# Illnesses of adopted siblings
"20107-0.0",# Illnesses of father code:1010
"20107-0.1",
"20107-0.2",
"20107-0.3",
"20107-0.4",
"20107-0.5",
"20107-0.6",
"20107-0.7",
"20107-0.8",
"20107-0.9",
"20107-1.0",#1
"20107-1.1",
"20107-1.2",
"20107-1.3",
"20107-1.4",
"20107-1.5",
"20107-1.6",
"20107-1.7",
"20107-1.8",
"20107-1.9",
"20107-2.0",#2
"20107-2.1",
"20107-2.2",
"20107-2.3",
"20107-2.4",
"20107-2.5",
"20107-2.6",
"20107-2.7",
"20107-2.8",
"20107-2.9",
"20107-3.0",#3
"20107-3.1",
"20107-3.2",
"20107-3.3",
"20107-3.4",
"20107-3.5",
"20107-3.6",
"20107-3.7",
"20107-3.8",
"20107-3.9",
"20110-0.0",# Illnesses of mother
"20110-0.1",
"20110-0.2",
"20110-0.3",
"20110-0.4",
"20110-0.5",
"20110-0.6",
"20110-0.7",
"20110-0.8",
"20110-0.9",
"20110-0.10",
"20110-1.0",#1
"20110-1.1",
"20110-1.2",
"20110-1.3",
"20110-1.4",
"20110-1.5",
"20110-1.6",
"20110-1.7",
"20110-1.8",
"20110-1.9",
"20110-1.10",
"20110-2.0",#2
"20110-2.1",
"20110-2.2",
"20110-2.3",
"20110-2.4",
"20110-2.5",
"20110-2.6",
"20110-2.7",
"20110-2.8",
"20110-2.9",
"20110-2.10",
"20110-3.0",#3
"20110-3.1",
"20110-3.2",
"20110-3.3",
"20110-3.4",
"20110-3.5",
"20110-3.6",
"20110-3.7",
"20110-3.8",
"20110-3.9",
"20110-3.10",
"20111-0.0",# Illnesses of siblings
"20111-0.1",
"20111-0.2",
"20111-0.3",
"20111-0.4",
"20111-0.5",
"20111-0.6",
"20111-0.7",
"20111-0.8",
"20111-0.9",
"20111-0.10",
"20111-0.11",
"20111-1.0",# 1
"20111-1.1",
"20111-1.2",
"20111-1.3",
"20111-1.4",
"20111-1.5",
"20111-1.6",
"20111-1.7",
"20111-1.8",
"20111-1.9",
"20111-1.10",
"20111-1.11",
"20111-2.0",# 2
"20111-2.1",
"20111-2.2",
"20111-2.3",
"20111-2.4",
"20111-2.5",
"20111-2.6",
"20111-2.7",
"20111-2.8",
"20111-2.9",
"20111-2.10",
"20111-2.11",
"20111-3.0",# 3
"20111-3.1",
"20111-3.2",
"20111-3.3",
"20111-3.4",
"20111-3.5",
"20111-3.6",
"20111-3.7",
"20111-3.8",
"20111-3.9",
"20111-3.10",
"20111-3.11",
##----1.19 主要死亡结局----
'40000-0.0',#Date of death 死亡日期
'40000-1.0',
'40001-0.0',#Underlying (primary) cause of death: ICD10 主要死亡原因 ICD-10 code:19
'40001-1.0',
#----次要死因--暂时不用
# starts_with("40002-"),#Contributory (secondary) causes of death: ICD10 次要死亡原因 ICD-10 code:19
##----1.20 发病结局----
#直接从原始数据中读取 这里不再导入
# starts_with("41270-"),# Diagnoses - ICD10 诊断 ICD-10 code:19
# starts_with("41280-"),#Date of first in-patient diagnosis - ICD10 首次住院诊断日期
#
# starts_with("41271-"),# Diagnoses - ICD9
# starts_with("41281-"),#Date of first in-patient diagnosis - ICD9 首次住院诊断日期
#
# starts_with("41202-"),#Diagnoses - main ICD10 诊断 ICD-10
# starts_with("41262-"),#Date of first in-patient diagnosis - main ICD10
#
# starts_with("41203-"),#main ICD9
# starts_with("41263-"),#Date of first in-patient diagnosis - main ICD9
#
#次级诊断-----暂时不用?
# '41204-0.0',#Diagnoses - secondary ICD10 诊断 ICD-10 二级
# '41205-0.0',#secondary ICD9
#
##----1.2? 其他()----
'20118-0.0',#Home area population density - urban or rural 居住地人口密度,城市/农村
'709-0.0',#number in household 家庭成员数
'6150-0.0',#Vascular/heart problems diagnosed by doctor 医生诊断的心脏问题
'2453-0.0',#Cancer diagnosed by doctor 癌症诊断
'2724-0.0',#Had menopause 绝经
'3894-0.0',#Age heart attack diagnosed 心脏病发作的年龄
'4022-0.0',#Age pulmonary embolism (blood clot in lung) diagnosed 诊断肺栓塞的年龄
'4056-0.0',#Age stroke diagnosed 诊断卒中的年龄
'135-0.0',#Number of self-reported non-cancer illnesses 自报非癌病数
'20002-0.0',#Non-cancer illness code, self-reported 自报非癌病编码,code:6
'20008-0.0',#Interpolated Year when non-cancer illness first diagnosed 首次诊断出非癌疾病的年份
'20009-0.0',#Interpolated Age of participant when non-cancer illness first diagnosed 首次诊断出非癌疾病的年龄
'191-0.0',#Date lost to follow-up 失访日期
'42000-0.0',#Date of myocardial infarction MI日期
'42002-0.0',#Date of STEMI STEMI日期
'42004-0.0',#Date of NSTEMI NSTEMI日期
'42006-0.0',#Date of stroke Stroke日期
'42008-0.0',#Date of ischaemic stroke I - stroke日期
'42010-0.0',#Date of intracerebral haemorrhage 脑出血
'42012-0.0',#Date of subarachnoid haemorrhage 蛛网膜下腔出血
'42026-0.0',#Date of end stage renal disease report 终末期肾病
'100001-0.0',#Food weight 食物重量
'100002-0.0',#Energy 能量
'100003-0.0',#Protein 蛋白质
'100004-0.0',#Fat 脂肪
'100005-0.0',#Carbohydrate 糖
'100006-0.0',#Saturated fat 饱和脂肪
'100007-0.0',#Polyunsaturated fat 多不饱和脂肪
'100008-0.0',#Total sugars 总糖
'100009-0.0',#Englyst dietary fibre 膳食纤维
) %>%
#----2. 重命名变量----
rename(
##----2.1 编号、年龄、性别等----
date_bl_1='53-0.0',# Date of attending assessment centre 注册时间
date_bl_2='53-1.0',
date_bl_3='53-2.0',
date_bl_4='53-3.0',
birth_year='34-0.0',#Year of birth 出生年份
birth_month='52-0.0',#month of birth 出生月份
age_recruitment='21022-0.0',# age at recruitment
birth_weight='20022-0.0',#Birth weight 出生体重
sex='31-0.0', #sex 性别
pulse_rate='102-0.0',#Pulse rate 脉搏率
heart_rate='4194-0.0',#Pulse rate 心率
##--2.2 血压----
dbp00='4079-0.0',#Diastolic blood pressure DBP
dbp01='4079-0.1',
dbp10='4079-1.0',
dbp11='4079-1.1',
dbp20='4079-2.0',
dbp21='4079-2.1',
dbp30='4079-3.0',
dbp31='4079-3.1',
sbp00='4080-0.0',#Systolic blood pressure SBP
sbp01='4080-0.1',
sbp10='4080-1.0',
sbp11='4080-1.1',
sbp20='4080-2.0',
sbp21='4080-2.1',
sbp30='4080-3.0',
sbp31='4080-3.1',
##----2.3 身高、体重和BMI----
bmi_1='21001-0.0',#Body mass index BMI
bmi_2='21001-1.0',
bmi_3='21001-2.0',
bmi_4='21001-3.0',
weight='23098-0.0',#Weight 体重
height='50-0.0',#standing height站高
waist_c='48-0.0',#waist circumference 腰围
hip_c='49-0.0',#hip circumference 臀围
##----2.4 种族----
race_1='21000-0.0',#Ethnic background 种族
race_2='21000-1.0',
race_3='21000-2.0',
##----2.5 教育----
edu_00='6138-0.0', #Qualifications 教育 code:100305
edu_01='6138-0.1',
edu_02='6138-0.2',
edu_03='6138-0.3',
edu_04='6138-0.4',
edu_05='6138-0.5',
edu_10='6138-1.0',
edu_11='6138-1.1',
edu_12='6138-1.2',
edu_13='6138-1.3',
edu_14='6138-1.4',
edu_15='6138-1.5',
edu_20='6138-2.0',
edu_21='6138-2.1',
edu_22='6138-2.2',
edu_23='6138-2.3',
edu_24='6138-2.4',
edu_25='6138-2.5',
edu_30='6138-3.0',
edu_31='6138-3.1',
edu_32='6138-3.2',
edu_33='6138-3.3',
edu_34='6138-3.4',
edu_35='6138-3.5',
edu_p0='10722-0.0',# Qualifications (pilot) 教育(飞行员?)code:10658
edu_p1='10722-0.1',
edu_p2='10722-0.2',
edu_p3='10722-0.3',
edu_p4='10722-0.4',
##-----2.6 diet部分-------
#水果
fresh_fruit_1='1309-0.0', # Fresh fruit intake 新鲜水果
fresh_fruit_2='1309-1.0',
fresh_fruit_3='1309-2.0',
fresh_fruit_4='1309-3.0',
dried_fruit_1='1319-0.0', # Dried fruit intake 干果
dried_fruit_2='1319-1.0',
dried_fruit_3='1319-2.0',
dried_fruit_4='1319-3.0',
#蔬菜
cooked_vegetable_1='1289-0.0', # Cooked vegetable intake 熟蔬菜
cooked_vegetable_2='1289-1.0',
cooked_vegetable_3='1289-2.0',
cooked_vegetable_4='1289-3.0',
raw_vegetable_1='1299-0.0', # Salad / raw vegetable intake 生蔬菜
raw_vegetable_2='1299-1.0',
raw_vegetable_3='1299-2.0',
raw_vegetable_4='1299-3.0',
#全谷物/精制谷物
bread_intake_1='1438-0.0', # Bread intake 面包
bread_intake_2='1438-1.0',
bread_intake_3='1438-2.0',
bread_intake_4='1438-3.0',
bread_type_1='1448-0.0', # Bread type 面包类型
bread_type_2='1448-1.0',
bread_type_3='1448-2.0',
bread_type_4='1448-3.0',
cereal_intake_1='1458-0.0', # Cereal intake 麦片
cereal_intake_2='1458-1.0',
cereal_intake_3='1458-2.0',
cereal_intake_4='1458-3.0',
cereal_type_1='1468-0.0', # Cereal type 麦片类型
cereal_type_2='1468-1.0',
cereal_type_3='1468-2.0',
cereal_type_4='1468-3.0',
#鱼
oily_fish_1='1329-0.0', # Oily fish intake 油性鱼
oily_fish_2='1329-1.0',
oily_fish_3= '1329-2.0',
oily_fish_4='1329-3.0',
non_oily_fish_1='1339-0.0', # Non-oily fish intake 非油性鱼
non_oily_fish_2='1339-1.0',
non_oily_fish_3='1339-2.0',
non_oily_fish_4='1339-3.0',
#奶制品
cheese_intake_1='1408-0.0', # Cheese intake 奶酪
cheese_intake_2='1408-1.0',
cheese_intake_3='1408-2.0',
cheese_intake_4= '1408-3.0',
milk_type_1='1418-0.0', # Milk type used 牛奶类型
milk_type_2='1418-1.0',
milk_type_3='1418-2.0',
milk_type_4='1418-3.0',
#肉类
processed_meat_1='1349-0.0', # Processed meat intake 加工肉类
processed_meat_2='1349-1.0',
processed_meat_3='1349-2.0',
processed_meat_4='1349-3.0',
age_meat_1='3680-0.0', # Age when last ate meat 上次吃肉的年龄
age_meat_2='3680-1.0',
age_meat_3='3680-2.0',
age_meat_4='3680-3.0',
poultry_1='1359-0.0', # Poultry intake 家禽
poultry_2='1359-1.0',
poultry_3='1359-2.0',
poultry_4='1359-3.0',
beef_1='1369-0.0', # Beef intake 牛肉
beef_2='1369-1.0',
beef_3='1369-2.0',
beef_4='1369-3.0',
lamb_1='1379-0.0', # Lamb/mutton intake 羊肉
lamb_2='1379-1.0',
lamb_3='1379-2.0',
lamb_4='1379-3.0',
pork_1='1389-0.0', # Pork intake 猪肉
pork_2='1389-1.0',
pork_3='1389-2.0',
pork_4='1389-3.0',
#加糖饮料
ssb_1='6144-0.0', # Never eat eggs, dairy, wheat, sugar 从不吃蛋、奶、小麦、糖?
ssb_2='6144-1.0',
ssb_3='6144-2.0',
ssb_4='6144-3.0',
non_butter_1="2654-0.0", # Non-butter spread type details
non_butter_2="2654-1.0",
non_butter_3="2654-2.0",
non_butter_4="2654-3.0",
spread_type_1='1428-0.0', # Spread type 涂酱类型
spread_type_2='1428-1.0',
spread_type_3='1428-2.0',
spread_type_4= '1428-3.0',
##----2.7 体力活动----
IPAQ='22032-0.0',#IPAQ ###----体力活动
met_walking='22037-0.0',#met_walking
met_moderate='22038-0.0',#met_moderate
met_vigorous='22039-0.0',#met_vigorous
##----2.8 睡眠----
sleep_duration_1='1160-0.0',#Sleep duration 睡眠时间
sleep_duration_2='1160-1.0',
sleep_duration_3='1160-2.0',
sleep_duration_4='1160-3.0',
get_up='1170-0.0',#Getting up in morning 早起难易程度
##----2.9 吸烟情况----
c_smoke_1='1239-0.0',#Current tobacco smoking 当前吸烟情况
c_smoke_2='1239-1.0',
c_smoke_3='1239-2.0',
c_smoke_4='1239-3.0',
p_smoke_1='1249-0.0',#Past tobacco smoking 过去吸烟情况
p_smoke_2='1249-1.0',
p_smoke_3='1249-2.0',
p_smoke_4='1249-3.0',
smoke100_1='2644-0.0',#吸过至少100支烟
smoke100_2='2644-1.0',
smoke100_3='2644-2.0',
smoke100_4='2644-3.0',
smoke_status_1='20116-0.0',#Smoking status 吸烟状态 "-3:Prefer not to answer 0:Never 1:Previous 2 Current"
smoke_status_2='20116-1.0',
smoke_status_3='20116-2.0',
smoke_status_4='20116-3.0',