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_Sfront65_Nbcd65.xlsx'
bh5 <- read_CVC(path1)
bh5
New names: * `` -> ...1
Study_ID | AC&BC_path | BC_path | AC_path |
---|---|---|---|
<dbl> | <dbl> | <dbl> | <dbl> |
21 | 0.92 | 0.71 | 0.93 |
48 | 0.92 | 0.63 | 0.93 |
52 | 0.93 | 0.67 | 0.93 |
54 | 0.92 | 0.64 | 0.92 |
55 | 0.92 | 0.65 | 0.93 |
56 | 0.90 | 0.64 | 0.91 |
57 | 0.92 | 0.60 | 0.93 |
58 | 0.92 | 0.64 | 0.93 |
59 | 0.93 | 0.68 | 0.93 |
60 | 0.91 | 0.70 | 0.93 |
61 | 0.92 | 0.63 | 0.93 |
62 | 0.87 | 0.56 | 0.91 |
63 | 0.90 | 0.66 | 0.93 |
64 | 0.92 | 0.55 | 0.93 |
65 | 0.92 | 0.67 | 0.93 |
66 | 0.91 | 0.62 | 0.93 |
67 | 0.93 | 0.64 | 0.93 |
68 | 0.92 | 0.65 | 0.93 |
69 | 0.91 | 0.65 | 0.93 |
70 | 0.92 | 0.67 | 0.93 |
71 | 0.92 | 0.63 | 0.92 |
72 | 0.93 | 0.69 | 0.93 |
73 | 0.92 | 0.67 | 0.93 |
74 | 0.91 | 0.58 | 0.93 |
75 | 0.88 | 0.61 | 0.92 |
76 | 0.92 | 0.66 | 0.93 |
77 | 0.92 | 0.62 | 0.93 |
78 | 0.92 | 0.68 | 0.93 |
79 | 0.93 | 0.64 | 0.93 |
80 | 0.91 | 0.68 | 0.93 |
81 | 0.92 | 0.54 | 0.93 |
82 | 0.93 | 0.70 | 0.93 |
83 | 0.91 | 0.67 | 0.93 |
84 | 0.91 | 0.62 | 0.92 |
85 | 0.92 | 0.57 | 0.93 |
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.92 |
48 | AC&BC_path | 0.92 |
52 | AC&BC_path | 0.93 |
54 | AC&BC_path | 0.92 |
55 | AC&BC_path | 0.92 |
56 | AC&BC_path | 0.90 |
57 | AC&BC_path | 0.92 |
58 | AC&BC_path | 0.92 |
59 | AC&BC_path | 0.93 |
60 | AC&BC_path | 0.91 |
61 | AC&BC_path | 0.92 |
62 | AC&BC_path | 0.87 |
63 | AC&BC_path | 0.90 |
64 | AC&BC_path | 0.92 |
65 | AC&BC_path | 0.92 |
66 | AC&BC_path | 0.91 |
67 | AC&BC_path | 0.93 |
68 | AC&BC_path | 0.92 |
69 | AC&BC_path | 0.91 |
70 | AC&BC_path | 0.92 |
71 | AC&BC_path | 0.92 |
72 | AC&BC_path | 0.93 |
73 | AC&BC_path | 0.92 |
74 | AC&BC_path | 0.91 |
75 | AC&BC_path | 0.88 |
76 | AC&BC_path | 0.92 |
77 | AC&BC_path | 0.92 |
78 | AC&BC_path | 0.92 |
79 | AC&BC_path | 0.93 |
80 | AC&BC_path | 0.91 |
⋮ | ⋮ | ⋮ |
56 | AC_path | 0.91 |
57 | AC_path | 0.93 |
58 | AC_path | 0.93 |
59 | AC_path | 0.93 |
60 | AC_path | 0.93 |
61 | AC_path | 0.93 |
62 | AC_path | 0.91 |
63 | AC_path | 0.93 |
64 | AC_path | 0.93 |
65 | AC_path | 0.93 |
66 | AC_path | 0.93 |
67 | AC_path | 0.93 |
68 | AC_path | 0.93 |
69 | AC_path | 0.93 |
70 | AC_path | 0.93 |
71 | AC_path | 0.92 |
72 | AC_path | 0.93 |
73 | AC_path | 0.93 |
74 | AC_path | 0.93 |
75 | AC_path | 0.92 |
76 | AC_path | 0.93 |
77 | AC_path | 0.93 |
78 | AC_path | 0.93 |
79 | AC_path | 0.93 |
80 | AC_path | 0.93 |
81 | AC_path | 0.93 |
82 | AC_path | 0.93 |
83 | AC_path | 0.93 |
84 | AC_path | 0.92 |
85 | AC_path | 0.93 |
clm = colnames(bh5)
sp = clm[-1]
ttl = "BAHA5P-group: CVC-score for the three sound paths,
in the condition S in front and N at BCD-side"
ColorBlind3 <- c("#E69F00", "#56B4E9", "#009E73")
p <- 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.5, 1))
l <- legend("bottomleft", legend = sp, title = "Sound-path", cex=1.1, pch = 16, col = ColorBlind3)
tiff("/home/guido/R/cingle/figures/CVC_Sf_Nbcd.tiff", units="in", width=7, height=7, res=300)
p <- 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.5, 1))
l <- legend("bottomleft", legend = sp, title = "Sound-path", cex=1.1, pch = 16, col = ColorBlind3)
dev.off()