── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(showtext)
Loading required package: sysfonts
Loading required package: showtextdb
Attaching package: 'showtextdb'
The following object is masked from 'package:extrafont':
font_install
df_pie |>ggplot(aes(x = group, y = n, by = group)) +geom_bar(aes(fill = outcome), position ="fill", stat="identity")+geom_text(aes(label = n), stat ="identity", position =position_fill(1))+coord_flip()+theme_void()+theme(legend.position ="bottom", )+scale_fill_brewer(palette =1, type ="qual")
misc emoji
df <- df1 |>bind_rows(df2) |>bind_rows(df3) |>bind_rows(df4) |>bind_rows(df5) |>bind_rows(df6)df |>count(result, arm, id) |>mutate(combcolor =case_when( result ==1& arm =="Arm A"~".A1", result ==0& arm =="Arm A"~"A0", result ==1& arm =="Arm B"~".B1", result ==0& arm =="Arm B"~"B0" )) |>arrange(combcolor) |>mutate(result = result |>factor(labels =c("sucess", "fail"))) |>ggplot() +geom_waffle(aes(values = n, fill = combcolor), n_rows =5, size =2, colour ="white", geom ="person", inherit.aes = F, glyph ="male") +coord_equal() +theme_void() +facet_grid(id~ arm)+scale_fill_manual(values =c("#00ba38","#619cff", alpha("#00ba38", 1/3), alpha("#619cff", 1/3)),labels =c("A1", "B1","A0", "B0") )+theme(legend.position ="bottom")
df |>count(result, arm, id) |>mutate(combcolor =case_when( result ==1& arm =="Arm A"~".A1", result ==0& arm =="Arm A"~"A0", result ==1& arm =="Arm B"~".B1", result ==0& arm =="Arm B"~"B0" )) |>arrange(combcolor) |>mutate(result = result |>factor(labels =c("sucess", "fail"))) |>ggplot() +geom_pictogram(aes(values = n, fill = combcolor), n_rows =5, size =2, colour ="white", label ="male", inherit.aes = F) +coord_equal() +theme_void() +facet_grid(id~ arm)+scale_fill_manual(values =c("#00ba38","#619cff", alpha("#00ba38", 1/3), alpha("#619cff", 1/3)),labels =c("A1", "B1","A0", "B0") )+theme(legend.position ="bottom")
# ?geom_pictogram
df |>count(result, arm, id) |>mutate(combcolor =case_when( result ==1& arm =="Arm A"~".A1", result ==0& arm =="Arm A"~"A0", result ==1& arm =="Arm B"~".B1", result ==0& arm =="Arm B"~"B0" )) |>arrange(combcolor) |>mutate(result = result |>factor(labels =c("sucess", "fail"))) |>ggplot(aes(label = result, values = n) ) +geom_pictogram(n_rows =5, aes(colour = combcolor), # flip = TRUE, make_proportional = F,size =6 ) +scale_label_pictogram(name =NULL,values =c("male", "male", "male", "male") ) +coord_equal() +theme_enhance_waffle() +theme(legend.key.height =unit(1, "line"),legend.text =element_text(size =14, hjust =0, vjust =0.75) ) +facet_grid(id~ arm)+scale_color_manual(name =NULL,values =c("#00ba38","#619cff", alpha("#00ba38", 1/3), alpha("#619cff", 1/3)),labels =c("A1", "B1","A0", "B0") )+theme_void()