From 8e20aa38c031a078095888665ac68171ce561db2 Mon Sep 17 00:00:00 2001 From: Christian Wiat Date: Tue, 15 Dec 2020 13:35:24 +0100 Subject: [PATCH] ajout chargement si csv non present en local --- module3/exo1/analyse-syndrome-grippal.Rmd | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/module3/exo1/analyse-syndrome-grippal.Rmd b/module3/exo1/analyse-syndrome-grippal.Rmd index 771e78f..11afb10 100644 --- a/module3/exo1/analyse-syndrome-grippal.Rmd +++ b/module3/exo1/analyse-syndrome-grippal.Rmd @@ -44,7 +44,16 @@ Voici l'explication des colonnes donnée sur le [sur le site d'origine](https:// La première ligne du fichier CSV est un commentaire, que nous ignorons en précisant `skip=1`. ### Téléchargement ```{r} -data = read.csv(data_url, skip=1) +fpath="E:/git/mooc-rr/module3/exo1/incidence-PAY-3.csv" + +if ( !file.exists(fpath) ){ + # non local: download + fm<-readLines(data_url) + # write on disk + write(fm,fpath) + } +# oui, il est local : read local disk +data = read.csv(fpath, skip=1) ``` Regardons ce que nous avons obtenu: -- 2.18.1