From 995c4390058c0a174af0cea61ea17e0a0fef42c7 Mon Sep 17 00:00:00 2001 From: 3582521b868d7c148df1de482ec5a734 <3582521b868d7c148df1de482ec5a734@app-learninglab.inria.fr> Date: Wed, 15 Nov 2023 20:18:10 +0000 Subject: [PATCH] Update influenza-like-illness-analysis.Rmd --- module3/exo1/influenza-like-illness-analysis.Rmd | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/module3/exo1/influenza-like-illness-analysis.Rmd b/module3/exo1/influenza-like-illness-analysis.Rmd index 25ee910..3057235 100644 --- a/module3/exo1/influenza-like-illness-analysis.Rmd +++ b/module3/exo1/influenza-like-illness-analysis.Rmd @@ -21,7 +21,17 @@ knitr::opts_chunk$set(echo = TRUE) ## Data preprocessing -The data on the incidence of influenza-like illness are available from the Web site of the [Réseau Sentinelles](http://www.sentiweb.fr/). +The data on the incidence of influenza-like illness are available from the Web site of the [Réseau Sentinelles](http://www.sentiweb.fr/). We download them as a file in CSV format, in which each line corresponds to a week in the observation period. Only the complete dataset, starting in 1984 and ending with a recent week, is available for download. The URL is: The data on the incidence of influenza-like illness are available from the Web site of the [Réseau Sentinelles](http://www.sentiweb.fr/). +```{r} +data_url = "http://www.sentiweb.fr/datasets/incidence-PAY-3.csv" +``` +In order to protect us in case the Réseau Sentinelles Web server disappears or is modified, we make a local copy of this dataset that we store together with our analysis. It is unnecessary and even risky to download the data at each execution, because in case of a malfunction we might be replacing our file by a corrupted version. Therefore we download the data only if no local copy exists. +```{r} +data_file = "incidence-PAY-3.csv" +if (!file.exists(data_file)) { + download.file(data_url, data_file, method="auto") +} +``` This is the documentation of the data from [the download site](https://ns.sentiweb.fr/incidence/csv-schema-v1.json): @@ -42,7 +52,7 @@ This is the documentation of the data from [the download site](https://ns.sentiw The first line of the CSV file is a comment, which we ignore with `skip=1`. ```{r} -data = read.csv("incidence-PAY-3.csv", skip=1,na.strings = "-") +data = read.csv(data_file, skip=1,na.strings = "-") ``` Let's have a look at what we got: -- 2.18.1