-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathshow_county.R
71 lines (28 loc) · 1.22 KB
/
show_county.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
# 選擇城市後 --> 輸出選擇城市的古蹟
heritage$show_county <- function(chosen_county){
final_result <- list()
for (i in seq_along(heritageData$belongCity)){
if (str_detect(heritageData$belongCity[[i]],pattern=chosen_county)){
heritageData$caseName[[i]] -> final_result[[i]]
final_result <- unlist(final_result)
final_result <- final_result[!is.na(final_result)]
}
}
return (final_result)
}
---------------
# 再將 heritage$show_country("城市") 的 caseID 取出 --> 儲存至user$sessionData$filtered_data
heritage$filter$countyChosen<- function( data ){
caseId <- list()
for (i in seq_along(data)){
caseId[[i]]<- heritageData$caseId[[i]]
}
return(caseId)
}
heritage$show_county(chosen_county ) -> user$sessionData$county_chosen
user$sessionData$filtered_data <-
append(user$sessionData$filtered_data,heritage$filter$countyChosen(user$sessionData$county_chosen))
# helper 1.1 caseName
user$sessionData$county_chosen
# helper 1.2 caseId
user$sessionData$filtered_data