##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)
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(scales)
## 
## Attachement du package : 'scales'
## 
## L'objet suivant est masqué depuis 'package:purrr':
## 
##     discard
## 
## L'objet suivant est masqué depuis 'package:readr':
## 
##     col_factor
library(labelled)
library(ggpattern)
##chargement des données 

data_thomas <- read_excel("Y:/DMs/Internes/Thomas 2023-2024/Picc Line/Mémoire PICC Line/analyses stats/20240531/data_thomas.xlsx")
## Warning: Expecting numeric in B12 / R12C2: got a date
## Warning: Expecting numeric in B22 / R22C2: got a date
## Warning: Expecting numeric in B24 / R24C2: got a date
## Warning: Expecting numeric in B37 / R37C2: got a date
## Warning: Expecting numeric in B41 / R41C2: got a date
## Warning: Expecting numeric in B46 / R46C2: got a date
## Warning: Expecting numeric in B52 / R52C2: got a date
## Warning: Expecting numeric in B65 / R65C2: got a date
## Warning: Expecting numeric in B67 / R67C2: got a date
## Warning: Expecting numeric in B75 / R75C2: got a date
## Warning: Expecting numeric in B76 / R76C2: got a date
## Warning: Expecting numeric in B79 / R79C2: got a date
## Warning: Expecting numeric in B82 / R82C2: got a date
## Warning: Expecting numeric in B89 / R89C2: got a date
## Warning: Expecting numeric in B105 / R105C2: got a date
##recodage bases de données le cas échéant----


picc<-filter(data_thomas, c(elligible=="oui" ))

##recodage des variables----

picc$age.cat<-ifelse(picc$age>65, 1, 0)
picc$duree_bloc.cat<-ifelse(picc$duree_bloc>50, 1, 0)
picc$sexe.cat<-ifelse(picc$sexe=="F", 1, 0)
picc$indic_atk<-ifelse(picc$indic_picc=="traitement anticancereux", 1, 0)
picc$indic_horsatk<-ifelse(picc$indic_picc=="hors anticancereux", 1, 0)
picc$indic_soinpal<-ifelse(picc$indic_picc=="soins paliatifs", 1, 0)
picc$indic_accesveineux<-ifelse(picc$indic_picc=="accès veineux", 1, 0)
picc$presta.cat<-ifelse(picc$circuit_presta=="oui", 1, 0)
picc$orl.cat<-ifelse(picc$spe_medicale=="orl", 1, 0)
picc$hemato.cat<-ifelse(picc$spe_medicale=="hemato", 1, 0)
picc$neuro.cat<-ifelse(picc$spe_medicale=="neuro", 1, 0)
picc$seno.cat<-ifelse(picc$spe_medicale=="senologie", 1, 0)
picc$sarcome.cat<-ifelse(picc$spe_medicale=="sarcome", 1, 0)
picc$gyneco.cat<-ifelse(picc$spe_medicale=="gyneco", 1, 0)
picc$uroo.cat<-ifelse(picc$spe_medicale=="urologie", 1, 0)
##renommer des variables pour présentation dans les tableaux de résultats



##renommer les variables pour un tableau population tous patients y compris ceux avec blases >5%
var_label(picc$age.cat) <- "Patients de + de 65 ans"
var_label(picc$sexe.cat) <- "Femmes"
var_label(picc$duree_bloc.cat) <- "Durée de bloc >50 min"
var_label(picc$circuit_presta) <- "Patient avec prestataire de soin à domicile"
var_label(picc$presta.cat) <- "Patient avec prestataire de soin à domicile"
var_label(picc$entretien_cat) <- "Patient ayant bénéficié d'un entretien picc_line"
var_label(picc$indic_picc) <- "Indication du picc-line"
var_label(picc$cancer_hemato) <- "Patient avec hémopathie maligne"
var_label(picc$duree_bloc) <- "Durée du bloc pour pose de picc-line"
var_label(picc$spe_medicale) <- "spécialité médicale"
var_label(picc$indic_atk) <- "Picc-line pour administration atk"
var_label(picc$indic_horsatk) <- "Picc-line pour administration medt autre que atk"
var_label(picc$indic_soinpal) <- "Picc-line pour administration soins paliatifs"
var_label(picc$indic_accesveineux) <- "Picc-line pour accès veineux"
var_label(picc$orl.cat) <- "Patient ORL"
var_label(picc$neuro.cat) <- "Patient neuro-oncologie"
var_label(picc$seno.cat) <- "Patient senologie"
var_label(picc$sarcome.cat) <- "Patient sarcome"
var_label(picc$gyneco.cat) <- "Patient gynecologie"
var_label(picc$uroo.cat) <- "Patient urologie"
var_label(picc$hemato.cat) <- "Patient hematologie"
##tableau descriptif population globales ----


tbl_summary(
  picc, include = c("age", "sexe", "spe_medicale", "orl.cat", "neuro.cat", "seno.cat", "sarcome.cat", "gyneco.cat", "uroo.cat", "hemato.cat", "duree_bloc","presta.cat", "indic_picc", "indic_atk", "indic_horsatk", "indic_soinpal", "indic_accesveineux", "cancer_hemato", ),
  statistic = all_continuous() ~ "{median} [{min} - {max}]",
  by="entretien_cat",
  digits=all_categorical()~ c(0,1)
)%>%
  add_p
## There was an error in 'add_p()/add_difference()' for variable 'spe_medicale', p-value omitted:
## Error in stats::fisher.test(structure(c("orl", "orl", "hemato", "orl", : FEXACT erreur 7(location). LDSTP=18630 est trop petit pour ce problème,
##   (pastp=30.6162, ipn_0:=ipoin[itp=397]=4607, stp[ipn_0]=30.2062).
## Augmentez la taille de l’environnement de travail ou considérez l’utilisation de ‘simulate.p.value=TRUE’.
Characteristic 0, N = 1551 1, N = 221 p-value2
age 63 [19 - 88] 67 [31 - 77] 0.4
sexe 0.3
    F 83 (53.5%) 9 (40.9%)
    M 72 (46.5%) 13 (59.1%)
spécialité médicale
    dermato 9 (5.8%) 0 (0.0%)
    digestif 3 (1.9%) 1 (4.5%)
    gyneco 21 (13.5%) 0 (0.0%)
    hemato 40 (25.8%) 4 (18.2%)
    hors_onco 1 (0.6%) 0 (0.0%)
    neuro 13 (8.4%) 0 (0.0%)
    orl 28 (18.1%) 5 (22.7%)
    sarcome 18 (11.6%) 8 (36.4%)
    senologie 9 (5.8%) 2 (9.1%)
    thyroide 2 (1.3%) 0 (0.0%)
    urologie 11 (7.1%) 2 (9.1%)
Patient ORL 28 (18.1%) 5 (22.7%) 0.6
Patient neuro-oncologie 13 (8.4%) 0 (0.0%) 0.4
Patient senologie 9 (5.8%) 2 (9.1%) 0.6
Patient sarcome 18 (11.6%) 8 (36.4%) 0.006
Patient gynecologie 21 (13.5%) 0 (0.0%) 0.080
Patient urologie 11 (7.1%) 2 (9.1%) 0.7
Patient hematologie 40 (25.8%) 4 (18.2%) 0.4
Durée du bloc pour pose de picc-line 52 [26 - 120] 43 [34 - 69] 0.047
Patient avec prestataire de soin à domicile 22 (14.2%) 14 (63.6%) <0.001
Indication du picc-line 0.026
    absence donnee 1 (0.6%) 1 (4.5%)
    accès veineux 14 (9.0%) 0 (0.0%)
    hors anticancereux 40 (25.8%) 2 (9.1%)
    soins paliatifs 20 (12.9%) 1 (4.5%)
    traitement anticancereux 80 (51.6%) 18 (81.8%)
Picc-line pour administration atk 80 (51.6%) 18 (81.8%) 0.008
Picc-line pour administration medt autre que atk 40 (25.8%) 2 (9.1%) 0.085
Picc-line pour administration soins paliatifs 20 (12.9%) 1 (4.5%) 0.5
Picc-line pour accès veineux 14 (9.0%) 0 (0.0%) 0.2
Patient avec hémopathie maligne 40 (25.8%) 4 (18.2%) 0.4
1 Median [Range]; n (%)
2 Wilcoxon rank sum test; Pearson’s Chi-squared test; Fisher’s exact test
###tableau descriptif devenir des patients 
tbl_summary(
  picc, include = c("retrait", "infection", "thrombose", "complic_meca","echec", "deces" ),
  statistic = all_continuous() ~ "{median} [{min} - {max}]",
  by="entretien_cat",
  digits=all_categorical()~ c(0,1)
)%>%
  add_p
Characteristic 0, N = 1551 1, N = 221 p-value2
retrait 0.018
    Non 77 (49.7%) 5 (22.7%)
    Oui 78 (50.3%) 17 (77.3%)
infection 0.8
    Non 126 (81.3%) 17 (77.3%)
    Oui 29 (18.7%) 5 (22.7%)
thrombose >0.9
    Non 149 (96.1%) 22 (100.0%)
    Oui 6 (3.9%) 0 (0.0%)
complic_meca 0.4
    Non 127 (81.9%) 16 (72.7%)
    Oui 28 (18.1%) 6 (27.3%)
echec >0.9
    Non 154 (99.4%) 22 (100.0%)
    Oui 1 (0.6%) 0 (0.0%)
deces 0.2
    Non 115 (74.2%) 19 (86.4%)
    Oui 40 (25.8%) 3 (13.6%)
1 n (%)
2 Pearson’s Chi-squared test; Fisher’s exact test
#Courbe de Kaplan Meier population globale durée sans complication----

km_complic<-survfit(Surv(picc$jdc, picc$complic)~1)

km_complic
## Call: survfit(formula = Surv(picc$jdc, picc$complic) ~ 1)
## 
##        n events median 0.95LCL 0.95UCL
## [1,] 177     73     71      61     117
ggsurvplot(km_complic, data = picc,
           risk.table=TRUE,
           surv.scale="percent",
           break.time.by=30,
           surv.median.line = "hv"
)

#Courbe de Kaplan Meier selon entretien pharma----

km_complic_entretien<-survfit(Surv(jdc, complic)~entretien_cat, data=picc)

km_complic_entretien
## Call: survfit(formula = Surv(jdc, complic) ~ entretien_cat, data = picc)
## 
##                   n events median 0.95LCL 0.95UCL
## entretien_cat=0 155     62     71      61     122
## entretien_cat=1  22     11     97      37      NA
survdiff(Surv(jdc, complic)~entretien_cat, data=picc)
## Call:
## survdiff(formula = Surv(jdc, complic) ~ entretien_cat, data = picc)
## 
##                   N Observed Expected (O-E)^2/E (O-E)^2/V
## entretien_cat=0 155       62     60.9    0.0182     0.112
## entretien_cat=1  22       11     12.1    0.0918     0.112
## 
##  Chisq= 0.1  on 1 degrees of freedom, p= 0.7
ggsurvplot(km_complic_entretien, data = picc,
           risk.table=TRUE,
           surv.scale="percent",
           break.time.by=30,
           surv.median.line = "hv"
)

##modeles de cox univariés--

modsurv<-coxph(Surv(jdc, complic)~entretien_cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Patient ayant bénéficié d'un entretien picc_line 0.90 0.47, 1.71 0.7
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~age, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
age 1.01 0.99, 1.02 0.5
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~age.cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Patients de + de 65 ans 1.29 0.81, 2.04 0.3
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~duree_bloc, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Durée du bloc pour pose de picc-line 1.00 0.98, 1.01 0.7
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~duree_bloc.cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Durée de bloc >50 min 1.22 0.77, 1.93 0.4
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~sexe.cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Femmes 1.12 0.70, 1.79 0.6
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~presta.cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Patient avec prestataire de soin à domicile 0.54 0.30, 0.99 0.048
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~indic_atk, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Picc-line pour administration atk 0.77 0.48, 1.23 0.3
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~indic_horsatk, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Picc-line pour administration medt autre que atk 1.35 0.81, 2.26 0.3
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~indic_accesveineux, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Picc-line pour accès veineux 1.09 0.44, 2.71 0.9
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~hemato.cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Patient hematologie 1.42 0.86, 2.33 0.2
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~orl.cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Patient ORL 0.73 0.37, 1.43 0.4
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~sarcome.cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Patient sarcome 1.19 0.64, 2.24 0.6
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~gyneco.cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Patient gynecologie 0.99 0.47, 2.06 >0.9
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~seno.cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Patient senologie 0.39 0.12, 1.25 0.11
1 HR = Hazard Ratio, CI = Confidence Interval
modsurv<-coxph(Surv(jdc, complic)~neuro.cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Patient neuro-oncologie 0.92 0.42, 2.00 0.8
1 HR = Hazard Ratio, CI = Confidence Interval
##modeles multivarié de cox--

modsurv<-coxph(Surv(jdc, complic)~presta.cat+entretien_cat+indic_atk+indic_horsatk+hemato.cat+seno.cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Patient avec prestataire de soin à domicile 0.55 0.27, 1.12 0.10
Patient ayant bénéficié d'un entretien picc_line 1.31 0.64, 2.70 0.5
Picc-line pour administration atk 0.98 0.47, 2.06 >0.9
Picc-line pour administration medt autre que atk 1.03 0.46, 2.31 >0.9
Patient hematologie 1.17 0.67, 2.06 0.6
Patient senologie 0.47 0.14, 1.51 0.2
1 HR = Hazard Ratio, CI = Confidence Interval
ggforest(modsurv)
## Warning in .get_data(model, data = data): The `data` argument is not provided.
## Data will be extracted from model fit.

modsurv<-coxph(Surv(jdc, complic)~presta.cat+entretien_cat+hemato.cat+seno.cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Patient avec prestataire de soin à domicile 0.54 0.27, 1.08 0.082
Patient ayant bénéficié d'un entretien picc_line 1.32 0.64, 2.69 0.5
Patient hematologie 1.19 0.71, 1.99 0.5
Patient senologie 0.47 0.14, 1.51 0.2
1 HR = Hazard Ratio, CI = Confidence Interval
ggforest(modsurv)
## Warning in .get_data(model, data = data): The `data` argument is not provided.
## Data will be extracted from model fit.

modsurv<-coxph(Surv(jdc, complic)~presta.cat+entretien_cat+seno.cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Patient avec prestataire de soin à domicile 0.52 0.26, 1.03 0.059
Patient ayant bénéficié d'un entretien picc_line 1.33 0.65, 2.74 0.4
Patient senologie 0.45 0.14, 1.43 0.2
1 HR = Hazard Ratio, CI = Confidence Interval
ggforest(modsurv)
## Warning in .get_data(model, data = data): The `data` argument is not provided.
## Data will be extracted from model fit.

modsurv<-coxph(Surv(jdc, complic)~presta.cat+entretien_cat, data=picc)
modsurv%>%tbl_regression(exponentiate = TRUE)
Characteristic HR1 95% CI1 p-value
Patient avec prestataire de soin à domicile 0.48 0.24, 0.96 0.037
Patient ayant bénéficié d'un entretien picc_line 1.33 0.64, 2.76 0.4
1 HR = Hazard Ratio, CI = Confidence Interval
ggforest(modsurv)
## Warning in .get_data(model, data = data): The `data` argument is not provided.
## Data will be extracted from model fit.