-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathadd_bulk_1_to_6_significance.R
180 lines (142 loc) · 8.49 KB
/
add_bulk_1_to_6_significance.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
library(tidyverse)
library(readxl)
library(openxlsx)
data_2019_200_1 <- read_excel(path = "data/ucop_data_2019_2020_1_v5.xlsx")
# Bulk number 1
bulk_1_part_1 <- read_excel(path = "sorties/finales/500_features_bulk_1/UCOP_heritage_features_bulk_1_part_1_update.xlsx",
sheet = "NameGroup")
bulk_1_part_1 <- bulk_1_part_1 %>%
bind_cols(read_excel(path = "sorties/finales/500_features_bulk_1/UCOP_heritage_features_bulk_1_part_1_update.xlsx",
sheet = "DescriptionGroup"))
bulk_1_part_1 %>%
left_join(x = ., y = data_2019_200_1 %>%
select(OS_Number, `Feature significance RCU`),
by = c("NAME.E41" = "OS_Number")) %>%
mutate(GENERAL_DESCRIPTION_TYPE.E55 = paste0(GENERAL_DESCRIPTION_TYPE.E55, "|", "Summary of Significance")) %>%
mutate(GENERAL_DESCRIPTION.E62 = if_else(
condition = !is.na(`Feature significance RCU`), true = paste0(GENERAL_DESCRIPTION.E62, "|", `Feature significance RCU`),
paste0(GENERAL_DESCRIPTION.E62, "|", "x")
)) %>%
select(NAME.E41, GENERAL_DESCRIPTION_TYPE.E55, GENERAL_DESCRIPTION.E62) -> bulk_1_part_1
write.xlsx(x = bulk_1_part_1, file = "sorties/finales/500_features_bulk_1/significance_bulk_1_part_1.xlsx")
# Bulk number 1 : part 2
bulk_1_part_2 <- read_excel(path = "sorties/finales/500_features_bulk_1/UCOP_heritage_features_bulk_1_part_2_update.xlsx",
sheet = "NameGroup")
bulk_1_part_2 <- bulk_1_part_2 %>%
bind_cols(read_excel(path = "sorties/finales/500_features_bulk_1/UCOP_heritage_features_bulk_1_part_2_update.xlsx",
sheet = "DescriptionGroup"))
bulk_1_part_2 %>%
left_join(x = ., y = data_2019_200_1 %>%
select(OS_Number, `Feature significance RCU`),
by = c("NAME.E41" = "OS_Number")) %>%
mutate(GENERAL_DESCRIPTION_TYPE.E55 = paste0(GENERAL_DESCRIPTION_TYPE.E55, "|", "Summary of Significance")) %>%
mutate(GENERAL_DESCRIPTION.E62 = if_else(
condition = !is.na(`Feature significance RCU`), true = paste0(GENERAL_DESCRIPTION.E62, "|", `Feature significance RCU`),
paste0(GENERAL_DESCRIPTION.E62, "|", "x")
)) %>%
select(NAME.E41, GENERAL_DESCRIPTION_TYPE.E55, GENERAL_DESCRIPTION.E62) -> bulk_1_part_2
write.xlsx(x = bulk_1_part_2, file = "sorties/finales/500_features_bulk_1/significance_bulk_1_part_2.xlsx")
# Bulk number 2
bulk_2 <- read_excel(path = "sorties/finales/500_features_bulk_2/UCOP_heritage_features_bulk_number_2.xlsx",
sheet = "NameGroup")
bulk_2 <- bulk_2 %>%
bind_cols(read_excel(path = "sorties/finales/500_features_bulk_2/UCOP_heritage_features_bulk_number_2.xlsx",
sheet = "DescriptionGroup"))
bulk_2 %>%
left_join(x = ., y = data_2019_200_1 %>%
select(OS_Number, `Feature significance RCU`),
by = c("NAME.E41" = "OS_Number")) %>%
mutate(GENERAL_DESCRIPTION_TYPE.E55 = paste0(GENERAL_DESCRIPTION_TYPE.E55, "|", "Summary of Significance")) %>%
mutate(GENERAL_DESCRIPTION.E62 = if_else(
condition = !is.na(`Feature significance RCU`), true = paste0(GENERAL_DESCRIPTION.E62, "|", `Feature significance RCU`),
paste0(GENERAL_DESCRIPTION.E62, "|", "x")
)) %>%
select(NAME.E41, GENERAL_DESCRIPTION_TYPE.E55, GENERAL_DESCRIPTION.E62) -> bulk_2
write.xlsx(x = bulk_2, file = "sorties/finales/500_features_bulk_2/significance_bulk_2.xlsx")
# Bulk number 3
bulk_3 <- read_excel(path = "sorties/finales/500_features_bulk_3/UCOP_heritage_features_bulk_number_3.xlsx",
sheet = "NameGroup")
bulk_3 <- bulk_3 %>%
bind_cols(read_excel(path = "sorties/finales/500_features_bulk_3/UCOP_heritage_features_bulk_number_3.xlsx",
sheet = "DescriptionGroup"))
bulk_3 %>%
left_join(x = ., y = data_2019_200_1 %>%
select(OS_Number, `Feature significance RCU`),
by = c("NAME.E41" = "OS_Number")) %>%
mutate(GENERAL_DESCRIPTION_TYPE.E55 = paste0(GENERAL_DESCRIPTION_TYPE.E55, "|", "Summary of Significance")) %>%
mutate(GENERAL_DESCRIPTION.E62 = if_else(
condition = !is.na(`Feature significance RCU`), true = paste0(GENERAL_DESCRIPTION.E62, "|", `Feature significance RCU`),
paste0(GENERAL_DESCRIPTION.E62, "|", "x")
)) %>%
select(NAME.E41, GENERAL_DESCRIPTION_TYPE.E55, GENERAL_DESCRIPTION.E62) -> bulk_3
write.xlsx(x = bulk_3, file = "sorties/finales/500_features_bulk_3/significance_bulk_3.xlsx")
# Bulk number 4
bulk_4 <- read_excel(path = "sorties/finales/500_features_bulk_4/UCOP_heritage_features_bulk_number_4.xlsx",
sheet = "NameGroup")
bulk_4 <- bulk_4 %>%
bind_cols(read_excel(path = "sorties/finales/500_features_bulk_4/UCOP_heritage_features_bulk_number_4.xlsx",
sheet = "DescriptionGroup"))
bulk_4 %>%
left_join(x = ., y = data_2019_200_1 %>%
select(OS_Number, `Feature significance RCU`),
by = c("NAME.E41" = "OS_Number")) %>%
mutate(GENERAL_DESCRIPTION_TYPE.E55 = paste0(GENERAL_DESCRIPTION_TYPE.E55, "|", "Summary of Significance")) %>%
mutate(GENERAL_DESCRIPTION.E62 = if_else(
condition = !is.na(`Feature significance RCU`), true = paste0(GENERAL_DESCRIPTION.E62, "|", `Feature significance RCU`),
paste0(GENERAL_DESCRIPTION.E62, "|", "x")
)) %>%
select(NAME.E41, GENERAL_DESCRIPTION_TYPE.E55, GENERAL_DESCRIPTION.E62) -> bulk_4
write.xlsx(x = bulk_4, file = "sorties/finales/500_features_bulk_4/significance_bulk_4.xlsx")
# Bulk number 5
bulk_5 <- read_excel(path = "sorties/finales/500_features_bulk_5/UCOP_heritage_features_bulk_number_5.xlsx",
sheet = "NameGroup")
bulk_5 <- bulk_5 %>%
bind_cols(read_excel(path = "sorties/finales/500_features_bulk_5/UCOP_heritage_features_bulk_number_5.xlsx",
sheet = "DescriptionGroup"))
bulk_5 %>%
mutate(OS_Number = str_sub(string = NAME.E41, start = 1, end = 8)) %>%
left_join(x = ., y = data_2019_200_1 %>%
select(OS_Number, `Feature significance RCU`),
by = "OS_Number") %>%
mutate(GENERAL_DESCRIPTION_TYPE.E55 = paste0(GENERAL_DESCRIPTION_TYPE.E55, "|", "Summary of Significance")) %>%
mutate(GENERAL_DESCRIPTION.E62 = if_else(
condition = !is.na(`Feature significance RCU`), true = paste0(GENERAL_DESCRIPTION.E62, "|", `Feature significance RCU`),
paste0(GENERAL_DESCRIPTION.E62, "|", "x")
)) %>%
select(NAME.E41, GENERAL_DESCRIPTION_TYPE.E55, GENERAL_DESCRIPTION.E62) -> bulk_5
write.xlsx(x = bulk_5, file = "sorties/finales/500_features_bulk_5/significance_bulk_5.xlsx")
# Bulk number 6
bulk_6 <- read_excel(path = "sorties/finales/500_features_bulk_6/UCOP_heritage_features_bulk_number_6.xlsx",
sheet = "NameGroup")
bulk_6 <- bulk_6 %>%
bind_cols(read_excel(path = "sorties/finales/500_features_bulk_6/UCOP_heritage_features_bulk_number_6.xlsx",
sheet = "DescriptionGroup"))
bulk_6 %>%
mutate(OS_Number = str_sub(string = NAME.E41, start = 1, end = 8)) %>%
left_join(x = ., y = data_2019_200_1 %>%
select(OS_Number, `Feature significance RCU`),
by = "OS_Number") %>%
mutate(GENERAL_DESCRIPTION_TYPE.E55 = paste0(GENERAL_DESCRIPTION_TYPE.E55, "|", "Summary of Significance")) %>%
mutate(GENERAL_DESCRIPTION.E62 = if_else(
condition = !is.na(`Feature significance RCU`), true = paste0(GENERAL_DESCRIPTION.E62, "|", `Feature significance RCU`),
paste0(GENERAL_DESCRIPTION.E62, "|", "x")
)) %>%
select(NAME.E41, GENERAL_DESCRIPTION_TYPE.E55, GENERAL_DESCRIPTION.E62) -> bulk_6
write.xlsx(x = bulk_6, file = "sorties/finales/500_features_bulk_6/significance_bulk_6.xlsx")
# adding significance to heritage places 2019
hp_2019 <- read_excel(path = "sorties/finales/2019/UCOP_heritage_places_2019_update.xlsx",
sheet = "NameGroup")
hp_2019 <- hp_2019 %>%
bind_cols(read_excel(path = "sorties/finales/2019/UCOP_heritage_places_2019_update.xlsx",
sheet = "DescriptionGroup"))
hp_2019 %>%
left_join(x = ., y = data_2019_200_1 %>%
select(OS_Number, `Feature significance RCU`),
by = c("NAME.E41" = "OS_Number")) %>%
mutate(GENERAL_DESCRIPTION_TYPE.E55 = paste0(GENERAL_DESCRIPTION_TYPE.E55, "|", "Summary of Significance")) %>%
mutate(GENERAL_DESCRIPTION.E62 = if_else(
condition = !is.na(`Feature significance RCU`), true = paste0(GENERAL_DESCRIPTION.E62, "|", `Feature significance RCU`),
paste0(GENERAL_DESCRIPTION.E62, "|", "x")
)) %>%
select(NAME.E41, GENERAL_DESCRIPTION_TYPE.E55, GENERAL_DESCRIPTION.E62) -> hp_2019
write.xlsx(x = hp_2019, file = "sorties/finales/2019/significance_hp_2019.xlsx")