@@ -41,7 +41,11 @@ We use only basic R functionality, so a earlier version might be OK, but we did
...
@@ -41,7 +41,11 @@ We use only basic R functionality, so a earlier version might be OK, but we did
* Data preprocessing
* Data preprocessing
The data on the incidence of influenza-like illness are available from the Web site of the [[http://www.sentiweb.fr/][Réseau Sentinelles]]. 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 [[http://www.sentiweb.fr/][Réseau Sentinelles]]. 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:
@@ -60,15 +64,40 @@ This is the documentation of the data from [[https://ns.sentiweb.fr/incidence/cs
...
@@ -60,15 +64,40 @@ This is the documentation of the data from [[https://ns.sentiweb.fr/incidence/cs
| ~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 |
The [[https://en.wikipedia.org/wiki/ISO_8601][ISO-8601]] format is popular in Europe, but less so in North America. This may explain why few software packages handle this format. The Python language does it since version 3.6. We therefore use Python for the pre-processing phase, which has the advantage of not requiring any additional library. (Note: we will explain in module 4 why it is desirable for reproducibility to use as few external libraries as possible.)
The [[https://en.wikipedia.org/wiki/ISO_8601][ISO-8601]] format is popular in Europe, but less so in North
America. This may explain why few software packages handle this
format. The Python language does it since version 3.6. We therefore
use Python for the pre-processing phase, which has the advantage of
not requiring any additional library. (Note: we will explain in module
4 why it is desirable for reproducibility to use as few external
libraries as possible.)
** Download
** Download
After downloading the raw data, we extract the part we are interested in. We first split the file into lines, of which we discard the first one that contains a comment. We then split the remaining lines into columns.
We first check if the data is available in a data file. Otherwise, we
Unfortunately there are many ways to indicate the absence of a data value in a dataset. Here we check for a common one: empty fields. For completeness, we should also look for non-numerical data in numerical columns. We don't do this here, but checks in later processing steps would catch such anomalies.
Unfortunately there are many ways to indicate the absence of a data value in a dataset. Here we check for a common one: empty fields. For completeness, we should also look for non-numerical data in numerical columns. We don't do this here, but checks in later processing steps would catch such anomalies.