##chargement des packages----
library(questionr)
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.1     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.2     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.1     
## ── 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(tableone)
library(labelled)
library(gtsummary)
## #BlackLivesMatter
library(GGally)
## Registered S3 method overwritten by 'GGally':
##   method from   
##   +.gg   ggplot2
library(readxl)
library(effects)
## Le chargement a nécessité le package : carData
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
library(survival)
library(survminer)
## Le chargement a nécessité le package : ggpubr
## 
## Attachement du package : 'survminer'
## 
## L'objet suivant est masqué depuis 'package:survival':
## 
##     myeloma
library(ggplot2)
library(dplyr)
library(knitr)
library(cowplot)
## 
## Attachement du package : 'cowplot'
## 
## L'objet suivant est masqué depuis 'package:ggpubr':
## 
##     get_legend
## 
## L'objet suivant est masqué depuis 'package:lubridate':
## 
##     stamp
##chargement des données 

stats_upco_24_25_light <- read_excel("Y:/fp/Departement Pharmacie/UPCO/Automatisation/stats_upco_24_25_light.xlsx")

##sous_groupes

prod<-filter(stats_upco_24_25_light, c(exploitable=="oui"))

prod$contenant_typ_pdt <- NA
prod$contenant_typ_pdt[prod$type_contenant == "poche_solvant_classique" & prod$type_pdt =="sol"] <- "solution en poche"
prod$contenant_typ_pdt[prod$type_contenant == "poche_solvant_classique" & prod$type_pdt =="pdre"] <- "poudre en poche"
prod$contenant_typ_pdt[prod$type_contenant == "seringue" & prod$type_pdt =="pdre"] <- "poudre en seringue"
prod$contenant_typ_pdt[prod$type_contenant == "seringue" & prod$type_pdt =="sol"] <- "solution en seringue"
prod$contenant_typ_pdt[prod$type_contenant == "poche_solvant_classique_probable_seringue" & prod$type_pdt =="sol"] <- "solution en seringue"

##types de présentations 

tbl_summary(
  prod, include = c("poche", "seringue", "solution", "poudre"),
  digits=all_categorical()~ c(0,1)
)
Characteristic N = 172,0851
poche
    non 53,728 (31.2%)
    oui 118,357 (68.8%)
seringue
    non 129,989 (75.5%)
    oui 42,096 (24.5%)
solution
    non 30,023 (17.4%)
    oui 142,062 (82.6%)
poudre
    non 142,062 (82.6%)
    oui 30,023 (17.4%)
1 n (%)
##Types de présentations selon anticipation

tbl_summary(
  prod, include = c("contenant_typ_pdt"),
  by="anticipation", 
  digits=all_categorical()~ c(0,1)
)%>%
  add_overall(last = TRUE)
Characteristic anticipation_48h_et_plus, N = 67,0231 ok_de_la_veille, N = 72,9671 prep_du_jour, N = 32,0951 Overall, N = 172,0851
contenant_typ_pdt
    poudre en poche 6,895 (10.8%) 8,702 (13.1%) 6,304 (21.1%) 21,901 (13.6%)
    poudre en seringue 4,123 (6.5%) 1,595 (2.4%) 1,089 (3.6%) 6,807 (4.2%)
    solution en poche 37,212 (58.3%) 42,187 (63.3%) 17,057 (57.0%) 96,456 (60.1%)
    solution en seringue 15,650 (24.5%) 14,140 (21.2%) 5,495 (18.4%) 35,285 (22.0%)
    Unknown 3,143 6,343 2,150 11,636
1 n (%)
##types de présentations selon médicaments

tbl_summary(
  prod, include = c("contenant_typ_pdt"),
  by="type_pa", 
  digits=all_categorical()~ c(0,1)
)%>%
  add_overall(last = TRUE)
Characteristic adc, N = 6,0231 antiviral, N = 4611 bispe, N = 2,0121 cytotox, N = 96,1491 mab, N = 56,7481 noncyto, N = 10,3391 protfus, N = 3531 Overall, N = 172,0851
contenant_typ_pdt
    poudre en poche 5,349 (89.4%) 397 (86.3%) 32 (1.6%) 14,988 (17.4%) 1,135 (2.1%) 0 (0.0%) 0 (0.0%) 21,901 (13.6%)
    poudre en seringue 0 (0.0%) 0 (0.0%) 0 (0.0%) 6,794 (7.9%) 13 (0.0%) 0 (0.0%) 0 (0.0%) 6,807 (4.2%)
    solution en poche 631 (10.5%) 29 (6.3%) 121 (6.0%) 61,245 (71.0%) 23,770 (43.2%) 10,339 (100.0%) 321 (90.9%) 96,456 (60.1%)
    solution en seringue 5 (0.1%) 34 (7.4%) 1,859 (92.4%) 3,277 (3.8%) 30,078 (54.7%) 0 (0.0%) 32 (9.1%) 35,285 (22.0%)
    Unknown 38 1 0 9,845 1,752 0 0 11,636
1 n (%)