Commit eae3f65a authored by Matthieu Haas's avatar Matthieu Haas

Faire le comparatif de l'incidence des syndromes grippaux

parent ccf2740c
---
title: "Analyse de l'incidence des syndromes grippaux"
author: "Matthieu HAAS"
date: "27/01/2021"
output:
pdf_document: default
html_document: default
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
Ce document a pour objectif d'analyser l'incidence des syndromes grippaux en France. Ces données proviennent du réseau sentinelle et courent de 1985 à aujourd'hui.
```{r}
data_url = "https://www.sentiweb.fr/datasets/incidence-PAY-3.csv"
```
```{r}
data = read.csv(file = data_url, skip = 1)
head(data)
```
```{r}
```
```{r}
lines_na = apply(data, 1, function(x) any(is.na(x)))
data[lines_na,]
```
```{r}
class(data$week)
```
```{r}
class(data$inc)
```
```{r}
library(parsedate)
```
```{r}
convert_week = function(date){
ws = paste(date)
iso =paste0(substring(ws, 1, 4), "-W", substring(ws, 5,6))
as.character(parse_iso_8601(iso))
}
```
```{r}
data$date = as.Date(sapply(data$week, convert_week))
```
```{r}
class(data$date)
```
```{r}
data = data[order(data$date),]
head(data)
```
```{r}
all(diff(data$date)==7)
```
```{r}
with(data,plot(date,inc, type = "l"))
```
```{r}
with(tail(data,200),plot(date,inc, type = "l"))
```
Ce graphique illustre bien l'effet de l'application de gestes barrières sur la prévention du syndrome grippal.
```{r}
pic_annuel=function(annee){
debut = paste0(annee-1, "-08-01")
fin = paste0(annee, "-08-01")
semaines = data$date > debut & data$date <= fin
sum(data$inc[semaines],na.rm=TRUE)
}
```
```{r}
annees = 1986 : 2020
```
```{r}
incidence_annuelle = data.frame(annee = annees, incidence = sapply(annees, pic_annuel))
```
```{r}
head(incidence_annuelle)
```
```{r}
plot(incidence_annuelle, type = "p")
```
```{r}
head(incidence_annuelle[order(-incidence_annuelle$incidence),])
```
```{r}
hist(incidence_annuelle$incidence, breaks = 10)
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment