library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.2 ──
## ✔ ggplot2 3.4.1 ✔ purrr 1.0.1
## ✔ tibble 3.1.8 ✔ dplyr 1.1.0
## ✔ tidyr 1.3.0 ✔ stringr 1.5.0
## ✔ readr 2.1.4 ✔ forcats 1.0.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
d1=read.csv("f:/80 Study/kirin stat/kirinblock1.csv")
colnames(d1)=tolower(colnames(d1))
library(moonBook)
mytable(bodypart~type + levels, method=3, data=d1)
##
## Descriptive Statistics by 'bodypart'
## ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
## Cervical Head Hip Lumbar Pelvis Shoulder Thoracic Wrist p
## (N=2124) (N=27) (N=1) (N=2593) (N=228) (N=121) (N=1812) (N=1)
## ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
## type 0.000
## - Arthrography 0 ( 0.0%) 0 ( 0.0%) 1 (100.0%) 0 ( 0.0%) 0 ( 0.0%) 93 (76.9%) 0 ( 0.0%) 1 (100.0%)
## - Brisement Maneuver 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 28 (23.1%) 0 ( 0.0%) 0 ( 0.0%)
## - Discography 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 1 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%)
## - DRG block 9 ( 0.4%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%)
## - Epidural Adhesiolysis 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 13 ( 0.5%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%)
## - Facet block 2 ( 0.1%) 0 ( 0.0%) 0 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 70 ( 3.9%) 1 (100.0%)
## - 2 1662 (78.2%) 0 ( 0.0%) 0 ( 0.0%) 2186 (84.3%) 223 (97.8%) 0 ( 0.0%) 1719 (94.9%) 0 ( 0.0%)
## - 3 146 ( 6.9%) 0 ( 0.0%) 0 ( 0.0%) 72 ( 2.8%) 0 ( 0.0%) 0 ( 0.0%) 18 ( 1.0%) 0 ( 0.0%)
## - 4 123 ( 5.8%) 0 ( 0.0%) 0 ( 0.0%) 203 ( 7.8%) 0 ( 0.0%) 0 ( 0.0%) 5 ( 0.3%) 0 ( 0.0%)
## - 6 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 1 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%)
## ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
d1 %>%
group_by(bodypart, type) %>%
summarise(total_levels=sum(levels))
## `summarise()` has grouped output by 'bodypart'. You can override using the
## `.groups` argument.
d2=d1%>%
filter(bodypart %in% c("Cervical", "Thoracic", "Lumbar", "Pelvis")) %>%
filter(type %in% c("Transforaminal Epidural", "Sympathetic Ganglion block", "Sup Hypogastric plexus block", "Interlaminar Epidural", "DRG block"))
mytable(bodypart~type, method=3, data=d2)
##
## Descriptive Statistics by 'bodypart'
## ——————————————————————————————————————————————————————————————————————————————————————————
## Cervical Lumbar Pelvis Thoracic p
## (N=2122) (N=2480) (N=224) (N=1812)
## ——————————————————————————————————————————————————————————————————————————————————————————
## type 0.000
## - DRG block 9 ( 0.4%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%)
## - Interlaminar Epidural 166 ( 7.8%) 31 ( 1.2%) 0 ( 0.0%) 0 ( 0.0%)
## - Sup Hypogastric plexus block 0 ( 0.0%) 0 ( 0.0%) 223 (99.6%) 0 ( 0.0%)
## - Sympathetic Ganglion block 0 ( 0.0%) 866 (34.9%) 1 ( 0.4%) 464 (25.6%)
## - Transforaminal Epidural 1947 (91.8%) 1583 (63.8%) 0 ( 0.0%) 1348 (74.4%)
## ——————————————————————————————————————————————————————————————————————————————————————————
mytable(bodypart~type + levels, method=3, data=d2)
##
## Descriptive Statistics by 'bodypart'
## ——————————————————————————————————————————————————————————————————————————————————————————
## Cervical Lumbar Pelvis Thoracic p
## (N=2122) (N=2480) (N=224) (N=1812)
## ——————————————————————————————————————————————————————————————————————————————————————————
## type 0.000
## - DRG block 9 ( 0.4%) 0 ( 0.0%) 0 ( 0.0%) 0 ( 0.0%)
## - Interlaminar Epidural 166 ( 7.8%) 31 ( 1.2%) 0 ( 0.0%) 0 ( 0.0%)
## - Sup Hypogastric plexus block 0 ( 0.0%) 0 ( 0.0%) 223 (99.6%) 0 ( 0.0%)
## - Sympathetic Ganglion block 0 ( 0.0%) 866 (34.9%) 1 ( 0.4%) 464 (25.6%)
## - Transforaminal Epidural 1947 (91.8%) 1583 (63.8%) 0 ( 0.0%) 1348 (74.4%)
## levels 0.000
## - 1 193 ( 9.1%) 117 ( 4.7%) 1 ( 0.4%) 70 ( 3.9%)
## - 2 1662 (78.3%) 2130 (85.9%) 223 (99.6%) 1719 (94.9%)
## - 3 145 ( 6.8%) 63 ( 2.5%) 0 ( 0.0%) 18 ( 1.0%)
## - 4 122 ( 5.7%) 170 ( 6.9%) 0 ( 0.0%) 5 ( 0.3%)
## ——————————————————————————————————————————————————————————————————————————————————————————
d2 %>%
group_by(bodypart, type) %>%
summarise(total_levels=sum(levels))
## `summarise()` has grouped output by 'bodypart'. You can override using the
## `.groups` argument.
library(ggplot2)
library(RColorBrewer)
p<-ggplot(d2, aes(x=type,y=sum(levels)/1000, fill=type)) +
geom_bar(stat="identity",postition="dodge") +
scale_fill_brewer(palette="YlOrRd") +
scale_x_discrete(limits = c("DRG block", "Transforaminal Epidural", "Sup Hypogastric plexus block", "Sympathetic Ganglion block", "Interlaminar Epidural"), labels = c("DRG", "경막외", "상하복신경총", "교감신경절", "경추간공")) +
scale_y_continuous(labels = scales::comma_format(scale = 1/1000)) +
facet_wrap(~bodypart, scales = "free_y", labeller=labeller(bodypart=c("Cervical"="경추", "Thoracic"="흉추", "Lumbar"="요추", "Pelvis"="골반"))) +
labs(x = "블럭종류", y = "시행 건수 (천 건)", fill = "Type") +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
## Warning in geom_bar(stat = "identity", postition = "dodge"): Ignoring unknown
## parameters: `postition`
p

p1= p +
theme(
panel.background = element_rect(fill='transparent'), #transparent panel bg
plot.background = element_rect(fill='transparent', color=NA), #transparent plot bg
legend.background = element_rect(fill='transparent'), #transparent legend bg
legend.box.background = element_rect(fill='transparent') #transparent legend panel
) +
theme(axis.title.x = element_text(face = "bold", color = "yellow"))+
theme(axis.title.y = element_text(face = "bold", color = "yellow")) +
theme(axis.text.x = element_text(face = "bold", color = "red")) +
theme(axis.text.y = element_text(face = "bold", color = "red")) +
theme(legend.text = element_text(face = "bold", color = "yellow")) +
theme(legend.position = "bottom") +
guides(fill = guide_legend(nrow = 5, byrow = TRUE))
ggsave("f:/80 Study/kirin stat/stat1.tif",plot=p1, device="tiff", dpi = 1200)
## Saving 7 x 5 in image