30 March 2021 GC, R code to plot beeswarm
library("readxl")
library('data.table')
library("beeswarm")
read_CVC <- function(path_in) {
dt <- read_excel(path_in)
dt <- dt[ -c(1, 7)]
bh5 <- subset(dt, Device=='BAHA5P')
bh5 <- bh5[ -c(2)]
bh5 <- bh5[, c(1, 4, 3, 2)]
return(bh5)
}
path1 <- '/media/guido/LACIE/Cingle_Guido/Master/Headband/CVC_Sbcd65_silence.xlsx'
bh5 <- read_CVC(path1)
bh5
New names: * `` -> ...1
Study_ID | AC&BC_path | BC_path | AC_path |
---|---|---|---|
<dbl> | <dbl> | <dbl> | <dbl> |
21 | 0.98 | 0.97 | 0.98 |
48 | 0.98 | 0.97 | 0.98 |
52 | 0.98 | 0.97 | 0.98 |
54 | 0.98 | 0.97 | 0.97 |
55 | 0.98 | 0.97 | 0.98 |
56 | 0.98 | 0.96 | 0.97 |
57 | 0.98 | 0.96 | 0.98 |
58 | 0.98 | 0.97 | 0.98 |
59 | 0.98 | 0.96 | 0.98 |
60 | 0.98 | 0.97 | 0.98 |
61 | 0.98 | 0.95 | 0.98 |
62 | 0.98 | 0.96 | 0.97 |
63 | 0.98 | 0.97 | 0.98 |
64 | 0.98 | 0.97 | 0.98 |
65 | 0.98 | 0.97 | 0.98 |
66 | 0.98 | 0.97 | 0.98 |
67 | 0.98 | 0.97 | 0.98 |
68 | 0.98 | 0.96 | 0.98 |
69 | 0.98 | 0.97 | 0.98 |
70 | 0.98 | 0.97 | 0.98 |
71 | 0.98 | 0.96 | 0.98 |
72 | 0.98 | 0.97 | 0.98 |
73 | 0.98 | 0.97 | 0.98 |
74 | 0.98 | 0.97 | 0.98 |
75 | 0.98 | 0.96 | 0.97 |
76 | 0.98 | 0.96 | 0.98 |
77 | 0.98 | 0.97 | 0.98 |
78 | 0.98 | 0.97 | 0.98 |
79 | 0.98 | 0.97 | 0.98 |
80 | 0.98 | 0.96 | 0.98 |
81 | 0.98 | 0.96 | 0.98 |
82 | 0.98 | 0.96 | 0.98 |
83 | 0.98 | 0.97 | 0.98 |
84 | 0.98 | 0.95 | 0.97 |
85 | 0.98 | 0.96 | 0.98 |
bh5_long <- melt(setDT(bh5), id.vars = c('Study_ID'),
value.name = 'CVC_score', variable.name = 'Sound_path')
bh5_long
Study_ID | Sound_path | CVC_score |
---|---|---|
<dbl> | <fct> | <dbl> |
21 | AC&BC_path | 0.98 |
48 | AC&BC_path | 0.98 |
52 | AC&BC_path | 0.98 |
54 | AC&BC_path | 0.98 |
55 | AC&BC_path | 0.98 |
56 | AC&BC_path | 0.98 |
57 | AC&BC_path | 0.98 |
58 | AC&BC_path | 0.98 |
59 | AC&BC_path | 0.98 |
60 | AC&BC_path | 0.98 |
61 | AC&BC_path | 0.98 |
62 | AC&BC_path | 0.98 |
63 | AC&BC_path | 0.98 |
64 | AC&BC_path | 0.98 |
65 | AC&BC_path | 0.98 |
66 | AC&BC_path | 0.98 |
67 | AC&BC_path | 0.98 |
68 | AC&BC_path | 0.98 |
69 | AC&BC_path | 0.98 |
70 | AC&BC_path | 0.98 |
71 | AC&BC_path | 0.98 |
72 | AC&BC_path | 0.98 |
73 | AC&BC_path | 0.98 |
74 | AC&BC_path | 0.98 |
75 | AC&BC_path | 0.98 |
76 | AC&BC_path | 0.98 |
77 | AC&BC_path | 0.98 |
78 | AC&BC_path | 0.98 |
79 | AC&BC_path | 0.98 |
80 | AC&BC_path | 0.98 |
⋮ | ⋮ | ⋮ |
56 | AC_path | 0.97 |
57 | AC_path | 0.98 |
58 | AC_path | 0.98 |
59 | AC_path | 0.98 |
60 | AC_path | 0.98 |
61 | AC_path | 0.98 |
62 | AC_path | 0.97 |
63 | AC_path | 0.98 |
64 | AC_path | 0.98 |
65 | AC_path | 0.98 |
66 | AC_path | 0.98 |
67 | AC_path | 0.98 |
68 | AC_path | 0.98 |
69 | AC_path | 0.98 |
70 | AC_path | 0.98 |
71 | AC_path | 0.98 |
72 | AC_path | 0.98 |
73 | AC_path | 0.98 |
74 | AC_path | 0.98 |
75 | AC_path | 0.97 |
76 | AC_path | 0.98 |
77 | AC_path | 0.98 |
78 | AC_path | 0.98 |
79 | AC_path | 0.98 |
80 | AC_path | 0.98 |
81 | AC_path | 0.98 |
82 | AC_path | 0.98 |
83 | AC_path | 0.98 |
84 | AC_path | 0.97 |
85 | AC_path | 0.98 |
clm = colnames(bh5)
sp = clm[-1]
ttl = "BAHA5P-group: CVC-score for the three sound paths,
in the condition in silence with S at BCD-side"
ColorBlind3 <- c("#E69F00", "#56B4E9", "#009E73")
beeswarm(CVC_score ~ Sound_path, data = bh5_long, pch = 16, col = ColorBlind3,
ylab = "CVC-score", xlab = "Sound-path", cex.lab=1.4, main = ttl, ylim=c(0.6, 1))
legend("bottomleft", legend = sp, title = "Sound-path", cex=1.1, pch = 16, col = ColorBlind3)
tiff("/home/guido/R/cingle/figures/CVC_Sbcd_silence.tiff", units="in", width=7, height=7, res=300)
beeswarm(CVC_score ~ Sound_path, data = bh5_long, pch = 16, col = ColorBlind3,
ylab = "CVC-score", xlab = "Sound-path", cex.lab=1.4, ylim=c(0.6, 1))
legend("bottomleft", legend = sp, title = "Sound-path", pch = 16, col = ColorBlind3, cex = 1.1)
dev.off()