-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAg_resistance.rmd
60 lines (57 loc) · 4.17 KB
/
Ag_resistance.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
df <- tibble::tribble(
~세정.일, ~Cell.ID, ~`1번`, ~`2번`, ~`3번`, ~`4번`, ~`5번`, ~`6번`, ~`7번`, ~`8번`,
"08월 02일", "2602EAB04", 3.6, 3.7, 3.6, 3.5, 3.6, 3.5, 3.5, 3.8,
NA, "2602EAA03", 3.8, 3.7, 3.8, 3.9, 4.3, 5.1, 4.8, 3.9,
"08월 03일", "2602GAB04", 3.5, 3.7, 3.6, 3.7, 4, 3.5, 3.5, 3.5,
NA, "2602IAA04", 3.5, 3.6, 3.6, 3.9, 3.9, 4.8, 5.2, 5.7,
"08월 04일", "2602AAB03", 4.4, 4.2, 4.1, 4.1, 4.3, 4.1, 4.3, 3.8,
NA, "2602HAA04", 3.8, 4, 4.2, 4, 4.1, 4.3, 4.1, 4.3,
"08월 05일", "2602AAA04", 4, 3.8, 3.8, 3.8, 3.8, 4.8, 4.1, 3.8,
NA, "2602LAA03", 4, 4.5, 4.4, 4.4, 4.7, 3.9, 4, 5.7,
"08월 08일", "2602BAB03", 4.9, 4.5, 4.5, 4.3, 4.2, 4.3, 4.2, 4.3,
NA, "2602BAA03", 4.2, 4.3, 4.4, 4.4, 3.9, 3.8, 3.9, 4.4,
"08월11일", "2602UAA01", 4, 4, 4.3, 4.1, 4.2, 4.3, 4.5, 4.4,
NA, "2602WAB01", 3.9, 4.2, 4.1, 4.6, 4.3, 4.2, 4.5, 4,
"08월 17일", "2606NAA02", 3.4, 3.4, 3.4, 3.3, 3.5, 3.5, 3.5, 3.6,
NA, "2606NAB02", 3.7, 3.6, 3.7, 3.4, 3.6, 3.4, 3.5, 3.6,
"08월 19일", "2606SAA04", 3.3, 3.5, 3.5, 3.3, 3.5, 3.3, 3.4, 3.2,
NA, "2606UAA01", 3.5, 3.7, 3.8, 3.3, 3.6, 3.4, 3.4, 3.4,
"08월 22일", "2606WAB01", 3.5, 3.8, 3.7, 3.6, 3.8, 3.5, 3.6, 3.6,
NA, "2606XAA02", 3.6, 3.6, 3.6, 3.5, 3.9, 3.7, 3.6, 3.9,
"08월 25일", "2606DAA04", 3.3, 3.7, 3.9, 3.6, 3.3, 3.4, 3.4, 3.2,
NA, "2606DAB03", 3.6, 3.7, 3.6, 3.5, 3.5, 3.4, 3.4, 3.3,
NA, "2606PAA01", 3.5, 3.6, 3.7, 3.3, 3.4, 3.4, 3.4, 3.5,
NA, "2606PAA02", 3.4, 3.6, 3.5, 3.5, 3.6, 3.5, 3.5, 4.2,
"08월 31일", "2512KAB02", 4.5, 2.6, 2.5, 3.8, 4.9, 4.1, 4.2, 4,
NA, "2512KAB04", 14.5, 3.2, 3.1, 4.5, 4.5, 4.6, 4.6, 5.4,
NA, "2512LAB02", NA, NA, NA, NA, NA, NA, NA, NA,
NA, "2512RAB02", 4.2, 2.6, 2.6, 4, 5.4, 5, 4.8, 5.5,
"09월 02일", "2510GAA02", NA, NA, NA, NA, NA, NA, NA, NA,
NA, "2510GAA03", NA, NA, NA, NA, NA, NA, NA, NA,
NA, "2510GAB01", NA, NA, NA, NA, NA, NA, NA, NA,
NA, "2608NAA02", 3.6, 3.7, 3.6, 3.6, 3.5, 3.6, 3.6, 3.7,
"09월 06일", "2608AAB04", 3.2, 3.4, 3.3, 3.2, 3.1, 3.1, 3.1, 3.2,
NA, "2608BAA01", 3.3, 3.4, 3.4, 3.1, 3.7, 3.4, 3.3, 3.2,
NA, "2608DAA02", 3.4, 3.4, 3.4, 3.5, 3.5, 3.4, 3.5, 3.6,
NA, "1507PAA02", NA, NA, NA, NA, NA, NA, NA, NA,
"09월 22일", "2704NAD02", 3.8, 4, 3.9, 3.8, 4.1, 4, 4, 3.8,
"09월 23일", "2704QAA01", 3.8, 3.7, 3.7, 3.8, 3.7, 3.8, 3.8, 3.9,
NA, "2704QAC01", 3.7, 3.8, 3.7, 3.8, 4, 3.8, 3.8, 3.8
)
head(df)
df <- df %>% fill(세정.일, .direction = "down") %>% na.omit()
df %>% pivot_longer(cols = `1번`: `8번`, names_to = "position", values_to = "resistance") %>%
mutate(side = ifelse(position %in% c("1번", "2번", "3번", "4번"), "장1변", "장2변")) %>%
mutate(decision = ifelse(resistance < 4.4, "pass", "fail")) %>%
mutate(decision = factor(decision, levels=c("pass", "fail"))) %>%
group_by(세정.일, side, decision) %>% summarise(Freq = sum(ifelse(decision == "pass", 1, -1)), .groups = "drop") %>% mutate(Freq = abs(Freq)) %>%
ggplot(aes(axis1 = 세정.일, axis2 = side, axis3 = decision,
y = Freq)) +
scale_x_discrete(limits = c("날짜", "side", "decision"), expand = c(.2, .05)) +
xlab("Demographic") +
geom_alluvium(aes(fill = decision)) +
geom_stratum() +
geom_text(stat = "stratum", aes(label = after_stat(stratum))) +
theme_minimal() +
ggtitle("Ag resistance measurement Data",
"stratified by date and side position (Pass : Ag < 4.4Ω, Fail : Ag ≥ 4.4Ω)")