sum(jj)
jj <- c(11,3,2,1,2,3,4,5,8,59)
sum(jj)
jj <- c(11,3,4,1,2,3,4,5,8,61)
j2 <- c(0,3,4,1,2,3,4,5,8,0)
barplot(jj)
barplot(jj,main="Distribution réelle",ylab="%",xlab="Probabilité de survie")
jj <- c(12,3,4,1,2,3,4,5,8,60)
barplot(jj,main="Distribution réelle",ylab="%",xlab="Probabilité de survie")
barplot(j2,col="blue")
barplot(jj,main="Distribution réelle",ylab="%",xlab="Probabilité de survie")
barplot(j2,col="blue",add=T)
text(3,40,"n=8140")
text(5,40,"n=8140")
text(5,30"% de survivants 67,3 vs 70,6")
text(5,30,"% de survivants 67,3 vs 70,6")
barplot(jj,main="Distribution réelle",ylab="%",xlab="Probabilité de survie")
barplot(j2,col="blue",add=T)
text(5,45,"% de survivants 67,3 vs 70,6")
text(5,40,"n=8140")
pdf("reel1",height=6,width=6)
barplot(jj,main="Distribution réelle",ylab="%",xlab="Probabilité de survie")
graphics.off()
pdf("reel2",height=6,width=6)
barplot(jj,main="Distribution réelle",ylab="%",xlab="Probabilité de survie")
barplot(j2,col="blue",add=T)
text(5,45,"% de survivants 67,3 vs 70,6")
text(5,40,"n=8140")
graphics.off()
quit()
y
### Descripteurs MESH
- Plus complexe, plus précise. Méthode par défaut
devtools::install_github("rstudio/addinexamples", type = "source")
install.packages("devtools")
devtools::install_github("rstudio/addinexamples", type = "source")
xaringan:::inf_mr()
---
#
![](images/data5.pdf)
![](images/mots1.pdf)
![](images/class.pdf)
library(xaringan)
library(xaringanthemer)
infinite_moon_reader()
xaringan:::inf_mr()
library(xaringanthemer)
library(xaringan)
tt <- read.csv("grippe.csv", header = TRUE)
tt$semaine <- ymd(tt$semaine)
library("lubridate")
tt <- read.csv("grippe.csv", header = TRUE)
tt$semaine <- ymd(tt$semaine)
zz <- tt %>%
pivot_wider(names_from = source, values_from = taux)
zz$sentinelle <- scale(zz$sentinelle) + 1
zz$google <- scale(zz$google) + 1
tt <- zz %>%
pivot_longer(c(google, sentinelle))
tt$name <- as.factor(tt$name)
tt$name <- relevel(tt$name,"sentinelle")
#
tt %>%
dplyr::filter(name == "sentinelle") %>%
ggplot() +
aes(x = semaine, y = value, color = name) +
geom_line(size = 1) +
labs(title = "Prévalence grippe",
x = "",
y = ""
) +
theme_tufte() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.text.x = element_text(size=12, face="bold"),
axis.text.y = element_blank(),
legend.position = "top",
legend.title = element_blank(),
legend.text = element_text(size=16, face="bold"),)
library("lubridate")
tt <- read.csv("grippe.csv", header = TRUE)
tt$semaine <- ymd(tt$semaine)
zz <- tt %>%
pivot_wider(names_from = source, values_from = taux)
zz$sentinelle <- scale(zz$sentinelle) + 1
zz$google <- scale(zz$google) + 1
tt <- zz %>%
pivot_longer(c(google, sentinelle))
tt$name <- as.factor(tt$name)
tt$name <- relevel(tt$name,"sentinelle")
#
tt %>%
dplyr::filter(name == "sentinelle") %>%
ggplot() +
aes(x = semaine, y = value, color = name) +
geom_line(size = 1) +
labs(title = "Prévalence grippe",
x = "",
y = ""
) +
theme_light() +
theme(plot.title = element_blank(),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.text.x = element_text(size=12, face="bold"),
axis.text.y = element_blank(),
legend.position = "top",
legend.title = element_blank(),
legend.text = element_text(size=16, face="bold"))
tt %>%
ggplot() +
aes(x = semaine, y = value ,col = name) +
geom_line(size = 1.) +
labs(title = "Prévalence grippe",
x = "",
y = ""
) +
theme_light() +
theme(plot.title =  element_blank(),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.text.x = element_text(size=12, face="bold"),
axis.text.y = element_blank(),
legend.position = "top",
legend.title = element_blank(),
legend.text = element_text(size=16, face="bold")
)
# knitr::opts_chunk$set(echo = TRUE, warning = TRUE, message = TRUE)
#
pp <- read.csv("patients.csv", header = TRUE)
summary(pp)
?geom_bar
ggplot(pp) +
aes(x = age) +
geom_bar()
? ntile
pp %>%
mutate(nn = ntile(age))
pp %>%
mutate(nn = ntile(age, n = 10))
pp %>%
ggplot() +
aes(x = age) +
geom_histogram()
? geom_histogram
pp %>%
ggplot() +
aes(x = age) +
geom_histogram(binwidth = 10)
pp %>%
ggplot() +
aes(x = age) +
geom_histogram(binwidth = 10, fill = "lightblue")
pp %>%
ggplot() +
aes(x = age) +
geom_histogram(binwidth = 10, fill = "lightblue", color = "black")
pp %>%
ggplot() +
aes(x = age) +
geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
labs(title = "Âge des patients",
x = "ans",
y = "n"
) +
theme_light() +
theme(plot.title =  element_blank(),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.text.x = element_text(size=12, face="bold"),
axis.text.y = element_blank(),
legend.position = "top",
legend.title = element_blank(),
legend.text = element_blank()
)
pp %>%
ggplot() +
aes(x = age) +
geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
labs(title = "Âge des patients",
x = "ans",
y = "n"
) +
theme_light() +
theme(plot.title =  element_blank(),
axis.title.x = element_blank(),
axis.title.y = element_blank(),
axis.text.x = element_text(size=12, face="bold"),
axis.text.y = element_blank(),
legend.position = "top",
legend.title = element_blank(),
legend.text = element_blank()
)
pp %>%
ggplot() +
aes(x = age) +
geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
labs(title = "Âge des patients",
x = "ans",
y = "n"
) +
theme_light() +
theme(plot.title =  element_text(size=14, face="bold"),
axis.title.x = element_text(size=12),
axis.title.y = element_text(size=12),
axis.text.x = element_text(size=12),
axis.text.y = element_text(size=12),
legend.position = element_blank(),
legend.title = element_blank(),
legend.text = element_text(size=16, face="bold")
pp %>%
ggplot() +
aes(x = age) +
geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
labs(title = "Âge des patients",
x = "ans",
y = "n"
) +
theme_light() +
theme(plot.title =  element_text(size=14, face="bold"),
axis.title.x = element_text(size=12),
axis.title.y = element_text(size=12),
axis.text.x = element_text(size=12),
axis.text.y = element_text(size=12),
legend.position = element_blank(),
legend.title = element_blank(),
legend.text = element_text(size=16, face="bold")
)
pp %>%
ggplot() +
aes(x = age) +
geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
labs(title = "Âge des patients",
x = "ans",
y = "n"
) +
theme_light() +
theme(plot.title =  element_text(size=14, face="bold"),
axis.title.x = element_text(size=12),
axis.title.y = element_text(size=12),
axis.text.x = element_text(size=12),
axis.text.y = element_text(size=12),
legend.position = "none"
)
pp %>%
ggplot() +
aes(x = na.omit(age)) +
geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
labs(title = "Âge des patients",
x = "ans",
y = "n"
) +
theme_light() +
theme(plot.title =  element_text(size=14, face="bold"),
axis.title.x = element_text(size=12),
axis.title.y = element_text(size=12),
axis.text.x = element_text(size=12),
axis.text.y = element_text(size=12),
legend.position = "none"
)
zz <- na.omit(pp) %>%
group_by(sexe) %>%
summarise(mm = mean)
zz <- na.omit(pp) %>%
group_by(sexe) %>%
summarise(mm = mean())
zz <- na.omit(pp) %>%
group_by(sexe) %>%
summarise(mm = mean(age))
zz
pp %>%
ggplot() +
aes(x = age) +
geom_histogram(binwidth = 10, fill = "lightblue", color = "black") +
labs(title = "Âge des patients",
x = "ans",
y = "n"
) +
theme_light() +
theme(plot.title =  element_text(size=14, face="bold"),
axis.title.x = element_text(size=12),
axis.title.y = element_text(size=12),
axis.text.x = element_text(size=12),
axis.text.y = element_text(size=12),
legend.position = "none"
)
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
# knitr::opts_chunk$set(echo = TRUE, warning = TRUE, message = TRUE)
#
pp <- read.csv("patients.csv", header = TRUE)
pp <- na.omit(pp)
barconfph <- function(dfx, lig,
titre = "", titx ="", tity="%",
seuil = 95, desc = TRUE, angle = FALSE){
varx <- enquo(lig)
lig <- pull(dfx,!!varx)
if (! is.factor(lig)){
return("Erreur : Variable non factorielle")
}
ligx <- c()
tlig <- table(lig)
ll <- length(tlig)
slig <- sum(tlig)
for (i in 1:ll){
# print(tlig[[i]])
ligp <- tangangPh(tlig[[i]],slig, seuil)
ligx <- rbind(ligx,ligp)
}
ligx <- as.data.frame(ligx)
names(ligx) <- c("pc", "binf", "bsup")
# print(lig)
ll <- levels(lig)
ligx$nom <- factor(ll,as.character(ll))
#return(ligx)
if (angle)
{ang <-  60
hh <-  1}
else
{ang <-  0
hh <-  0.5}
#
if (desc){
ligx <- ligx %>%
mutate(nom = fct_reorder(nom,desc(pc)))
}
gg <- ligx %>%
ggplot(aes(x= nom, y = pc, fill= nom)) +
geom_bar(stat = "identity") +
geom_errorbar(aes(ymin = binf, ymax = bsup),
width = 0.5,
size = 0.5) +
labs(title = titre,
x = titx,
y = tity
) +
theme_light() +
scale_fill_brewer(palette = "Blues") +
theme(plot.title = element_text(size=14, face = "bold"),
axis.title.x = element_text(size=12),
axis.title.y = element_text(size=12),
axis.text.x = element_text(size=12,angle = ang, hjust = hh),
axis.text.y = element_text(size=12),
legend.position ="none"
)# +
# scale_fill_viridis_d()
plot(gg)
}
str(pp)
barconf(pp,choc)
barconfph(pp,choc)
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
# knitr::opts_chunk$set(echo = TRUE, warning = TRUE, message = TRUE)
#
pp <- read.csv("patients.csv", header = TRUE, as.is=FALSE)
pp <- na.omit(pp)
pp <- read.csv("patients.csv", header = TRUE, as.is=FALSE)
barconfph(pp,choc)
tangangPh <- function(nn,tot,seuil = 95){
if (seuil > 100 | seuil < 0)
{return ("Erreur dans la marge de l'IC")}
else{
seu <- 1-(1-seuil/100)/2
pp <- nn/tot
sp <- qnorm(seu)/(2*sqrt(tot))
if (floor(pp*100) == 0){
binf <- 0
}
else {
binf <- sin(asin(sqrt(pp-1/(2*tot)))-sp)^2*100
}
if (ceiling(pp*100) == 100){
bsup <- 100
}
else{
bsup <- sin(asin(sqrt(pp+1/(2*tot)))+sp)^2*100
}
return (c(pp=pp*100,binf=binf,bsup=bsup))
}
#
barconfph <- function(dfx, lig,
titre = "", titx ="", tity="%",
seuil = 95, desc = TRUE, angle = FALSE){
varx <- enquo(lig)
lig <- pull(dfx,!!varx)
if (! is.factor(lig)){
return("Erreur : Variable non factorielle")
}
ligx <- c()
tlig <- table(lig)
ll <- length(tlig)
slig <- sum(tlig)
for (i in 1:ll){
# print(tlig[[i]])
ligp <- tangangPh(tlig[[i]],slig, seuil)
ligx <- rbind(ligx,ligp)
}
ligx <- as.data.frame(ligx)
names(ligx) <- c("pc", "binf", "bsup")
# print(lig)
ll <- levels(lig)
ligx$nom <- factor(ll,as.character(ll))
#return(ligx)
if (angle)
{ang <-  60
hh <-  1}
else
{ang <-  0
hh <-  0.5}
#
if (desc){
ligx <- ligx %>%
mutate(nom = fct_reorder(nom,desc(pc)))
}
gg <- ligx %>%
ggplot(aes(x= nom, y = pc, fill= nom)) +
geom_bar(stat = "identity") +
geom_errorbar(aes(ymin = binf, ymax = bsup),
width = 0.5,
size = 0.5) +
labs(title = titre,
x = titx,
y = tity
) +
theme_light() +
scale_fill_brewer(palette = "Blues") +
theme(plot.title = element_text(size=14, face = "bold"),
axis.title.x = element_text(size=12),
axis.title.y = element_text(size=12),
axis.text.x = element_text(size=12,angle = ang, hjust = hh),
axis.text.y = element_text(size=12),
legend.position ="none"
)# +
# scale_fill_viridis_d()
plot(gg)
}
legend.position ="none"
barconfph(pp,choc)
barconfph(pp,choc, titre="État de choc")
barconfph(pp,choc, titre="État de choc", angle = TRUE)
barconfph(pp,choc, titre="État de choc", angle = FALSE)
library(table1)
names(pp)
table1(~age+sexe+choc+esc, data = pp)
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
# knitr::opts_chunk$set(echo = TRUE, warning = TRUE, message = TRUE)
library("knitr")
library("table1")
#
pp <- read.csv("patients.csv", header = TRUE, as.is=FALSE)
pp <- na.omit(pp)
table1(~age+sexe+choc+esc, data = pp)
library(thesisph)
names(pp)
tabcompph((pp[,c(6:14,30)]))
tabcompph((pp[,c(6:14,30)]
tabcompph((pp[,c(6:14,30)])))
tabcompph(pp[,c(6:14,30)], esc)
tabcompph(pp[,c(6:10,30)], esc)
tabcompph(pp[,c(6:7,30)], esc)
tabcompph(pp[,c(7:8,30)], esc)
sumamry(pp$esc)
summary(pp$esc)
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
# knitr::opts_chunk$set(echo = TRUE, warning = TRUE, message = TRUE)
library("knitr")
library("table1")
library("thesisph")
#
pp <- read.csv("patients.csv", header = TRUE, as.is=FALSE)
tabcompph(pp[,c(6:14,30)], esc)
library(kableExtra)
tabcompph(pp[,c(6:14,30)], esc)
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
# knitr::opts_chunk$set(echo = TRUE, warning = TRUE, message = TRUE)
library("knitr")
library("table1")
library("thesisph")
library("kableExtra")
#
pp <- read.csv("patients.csv", header = TRUE, as.is=FALSE)
tabcompph(pp[,c(6,8:14,30)], esc)
ll <- glm(esc~age+taille+sexe.choc, data = pp, family= "binomial")
ll <- glm(esc~age+taille+sexe+choc, data = pp, family= "binomial")
tabmmph(ll)
?chisq.test
knitr::opts_chunk$set(echo = FALSE)
qq <- read.csv("quartet.csv", header = TRUE)
qq %>%
ggplot() +
aes(x = x, y = y, color = Jeu) +
geom_point(size = 3) +
geom_smooth(method = "lm", fullrange = TRUE, se = FALSE) +
facet_wrap(~ Jeu, ncol=2) +
labs(title = " Quartet d'Anscombe",
x = "x",
y = "y"
) + # Titres des axes
theme_light() + # Thème simple, idéal pour publication
theme(plot.title = element_text(size=16, face="bold"),
axis.title.x = element_text(size=12),
axis.title.y = element_text(size=12),
axis.text.x = element_text(size=12),
axis.text.y = element_text(size=12),# Pas de titre pour l'axe des y
legend.position = "none" # Pas de légende
) # Les axes, titres etc.
library(devtools)
devtools::install_github('RLesur/Rcade')
detach("package:tidyverse", unload = TRUE)
devtools::install_github('RLesur/Rcade')
install.packages(c("arsenal", "attachment", "brio", "broom", "cli", "coin", "colorspace", "correlation", "cpp11", "crayon", "crosstalk", "data.table", "DBI", "dbplyr", "deldir", "Deriv", "desc", "DescTools", "doBy", "dplyr", "expm", "fansi", "farver", "fastmap", "forcats", "forecast", "generics", "gert", "GGally", "ggforce", "ggplot2", "ggraph", "ggrepel", "ggsignif", "ggthemes", "glmnet", "Hmisc", "hms", "htmltools", "httpuv", "huxtable", "insight", "inum", "ipred", "IRdisplay", "isoband", "ISOcodes", "jsonlite", "kableExtra", "knitr", "labelled", "lava", "libcoin", "LiblineaR", "lifecycle", "lubridate", "magick", "magrittr", "MatrixModels", "matrixStats", "measures", "memoise", "mice", "mime", "mlbench", "multcomp", "officer", "parameters", "party", "partykit", "pbkrtest", "pillar", "pixmap", "pkgload", "pointblank", "pROC", "promises", "ps", "quanteda.textmodels", "quantreg", "R6", "rappdirs", "Rcpp", "RcppArmadillo", "RcppParallel", "recipes", "renv", "repr", "reprex", "rio", "rlang", "rmarkdown", "rmdformats", "rms", "RSQLite", "rstatix", "rticles", "rvest", "sass", "seasonal", "shiny", "shinyWidgets", "skimr", "SparseM", "SQUAREM", "survminer", "testthat", "tfruns", "tibble", "tidyr", "tinytex", "usethis", "vctrs", "VGAM", "vroom", "waldo", "withr", "xaringan", "xaringanthemer", "xfun", "xmlparsedata", "zoo"))
devtools::install_github('RLesur/Rcade')
