diff --git a/module3/Analyse_de_l-incidence_de_syndromes_grippaux.html b/module3/Analyse_de_l-incidence_de_syndromes_grippaux.html new file mode 100644 index 0000000000000000000000000000000000000000..aea040621b405f7837ed356002be1a22a9230897 --- /dev/null +++ b/module3/Analyse_de_l-incidence_de_syndromes_grippaux.html @@ -0,0 +1,289 @@ + + + + +
+ + + + + + + + + +data_url = "https://www.sentiweb.fr/datasets/incidence-PAY-3.csv"
+data = read.csv(data_url, skip=1)
+# visualisation des premiere et derniere valeur du tableau
+head(data)
+## week indicator inc inc_low inc_up inc100 inc100_low inc100_up geo_insee
+## 1 202148 3 40495 35027 45963 61 53 69 FR
+## 2 202147 3 36589 31328 41850 55 47 63 FR
+## 3 202146 3 30059 25302 34816 46 39 53 FR
+## 4 202145 3 20364 16564 24164 31 25 37 FR
+## 5 202144 3 18999 15042 22956 29 23 35 FR
+## 6 202143 3 27040 21935 32145 41 33 49 FR
+## geo_name
+## 1 France
+## 2 France
+## 3 France
+## 4 France
+## 5 France
+## 6 France
+tail(data)
+## week indicator inc inc_low inc_up inc100 inc100_low inc100_up
+## 1931 198449 3 101073 81684 120462 184 149 219
+## 1932 198448 3 78620 60634 96606 143 110 176
+## 1933 198447 3 72029 54274 89784 131 99 163
+## 1934 198446 3 87330 67686 106974 159 123 195
+## 1935 198445 3 135223 101414 169032 246 184 308
+## 1936 198444 3 68422 20056 116788 125 37 213
+## geo_insee geo_name
+## 1931 FR France
+## 1932 FR France
+## 1933 FR France
+## 1934 FR France
+## 1935 FR France
+## 1936 FR France
+lignes_na = apply(data, 1, function(x) any(is.na(x)))
+data[lignes_na,]
+## week indicator inc inc_low inc_up inc100 inc100_low inc100_up geo_insee
+## 1700 198919 3 0 NA NA 0 NA NA FR
+## geo_name
+## 1700 France
+class(data$week)
+## [1] "integer"
+class(data$inc)
+## [1] "integer"
+A cause des données manquantes dans le tutoriel de la formation la colonne “inc” est considérée comme un facteur alors que c’est un entier. Pour corriger ca il suffit de relire la fichier en spécifiant que le caractére ‘-’ est un NA
+ data = read.csv(data_url, skip = 1, na.strings = "-")
+ class(data$inc)
+## [1] "integer"
+library(parsedate)
+convert_week = function(date){
+ ws = paste(date)
+ iso = paste0(substring(ws, 1, 4), "-W", substring(ws, 5, 6))
+ as.character(parse_iso_8601(iso))
+}
+data$date = as.Date(sapply(data$week, convert_week))
+class(data$date)
+## [1] "Date"
+