Update influenza-like-illness-analysis.Rmd

parent da81c031
--- ---
title: "Incidence of influenza-like illness in France" title: "Incidence of influenza-like illness in France"
author: "Konrad Hinsen" author: "Eleni Gkiouzepi"
output: output:
pdf_document:
toc: true
html_document: html_document:
toc: true toc: true
theme: journal theme: journal
pdf_document:
toc: true
documentclass: article documentclass: article
classoption: a4paper classoption: a4paper
header-includes: header-includes:
- \usepackage[french]{babel} - \usepackage[english]{babel}
- \usepackage[upright]{fourier} - \usepackage[upright]{fourier}
- \hypersetup{colorlinks=true,pagebackref=true} - \hypersetup{colorlinks=true,pagebackref=true}
--- ---
...@@ -41,11 +41,25 @@ This is the documentation of the data from [the download site](https://ns.sentiw ...@@ -41,11 +41,25 @@ This is the documentation of the data from [the download site](https://ns.sentiw
| `geo_insee` | Identifier of the geographic area, from INSEE https://www.insee.fr | | `geo_insee` | Identifier of the geographic area, from INSEE https://www.insee.fr |
| `geo_name` | Geographic label of the area, corresponding to INSEE code. This label is not an id and is only provided for human reading | | `geo_name` | Geographic label of the area, corresponding to INSEE code. This label is not an id and is only provided for human reading |
### Download ### If the local file does not exist, download the data and put them into the local file
```{r}
destfile = "incidence-PAY-3.csv"
if(!file.exists(destfile)){
res <- tryCatch(download.file(data_url,
destfile,
method="auto"),
error=function(e) 1)
}
```
### Read the local CSV file.
The first line of the CSV file is a comment, which we ignore with `skip=1`. The first line of the CSV file is a comment, which we ignore with `skip=1`.
```{r} ```{r}
data = read.csv(data_url, skip=1) data = read.csv(destfile, skip=1)
``` ```
Let's have a look at what we got: Let's have a look at what we got:
...@@ -72,7 +86,8 @@ Integers, fine! ...@@ -72,7 +86,8 @@ Integers, fine!
Date handling is always a delicate subject. There are many conventions that are easily confused. Our dataset uses the [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) week number format, which is popular in Europe but less so in North America. In `R`, it is handled by the library [parsedate](https://cran.r-project.org/package=parsedate): Date handling is always a delicate subject. There are many conventions that are easily confused. Our dataset uses the [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) week number format, which is popular in Europe but less so in North America. In `R`, it is handled by the library [parsedate](https://cran.r-project.org/package=parsedate):
```{r} ```{r}
library(parsedate) if(!require(parsedate)) install.packages("parsedate")
require(parsedate)
``` ```
In order to facilitate the subsequent treatment, we replace the ISO week numbers by the dates of each week's Monday. This function does it for one value: In order to facilitate the subsequent treatment, we replace the ISO week numbers by the dates of each week's Monday. This function does it for one value:
...@@ -161,5 +176,6 @@ head(annnual_inc[order(-annnual_inc$incidence),]) ...@@ -161,5 +176,6 @@ head(annnual_inc[order(-annnual_inc$incidence),])
Finally, a histogram clearly shows the few very strong epidemics, which affect about 10% of the French population, but are rare: there were three of them in the course of 35 years. The typical epidemic affects only half as many people. Finally, a histogram clearly shows the few very strong epidemics, which affect about 10% of the French population, but are rare: there were three of them in the course of 35 years. The typical epidemic affects only half as many people.
```{r} ```{r}
hist(annnual_inc$incidence, breaks=10, xlab="Annual incidence", ylab="Number of observations", main="") hist(annnual_inc$incidence, breaks=10, xlab="Annual incidence",
ylab="Number of observations", main="")
``` ```
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