13 réponses sur « COVID-19 decease animation map »
[…] by data_admin [This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page […]
[…] See also the animated map. […]
Hello,
it’s very interesting, thanks. Could you please do the same animated GIF but with the 1st column « incid_hosp » of the file below which gives the number of NEW COVID19 hospitalizations per day and by department, which would be even more interesting I think. We could thus see the progression and the decrease of the epidemic. Thank you
OK, c’est 700 € la journée ; toute journée commencée est due.
(sinon le code est disponible ci-dessus)
:-/
[…] Creating the grid and conserving minimal topological relations and the general shape can be time consuming, but thanks to Geogrid it’s quite easy. The geogrid dev page provides nice examples. We will reuse our code of the COVID19 animation. […]
Bonjour, j’ai installé R 3.6.3 (je connais pas R), quand je lance le code avec `Rscript`, j’obtiens :
« `
Linking to ImageMagick 6.9.10.23
Enabled features: fontconfig, freetype, fftw, lcms, pango, webp, x11
Disabled features: cairo, ghostscript, rsvg
Using ‘,’ as decimal and ‘.’ as grouping mark. Use read_delim() for more control.
Parsed with column specification:
cols(
dep = col_character(),
sexe = col_double(),
jour = col_date(format = « »),
hosp = col_double(),
rea = col_double(),
rad = col_double(),
dc = col_double()
)
New names:
* « -> …1
* « -> …2
Warning message:
In st_point_on_surface.sf(.) :
st_point_on_surface assumes attributes are constant over geometries of x
reprojecting data…
reprojecting study zone…
generating reference grid…
Error: Columns 1 and 2 must be named.
Backtrace:
█
1. └─covid_geo_pop %>% lissage(« deces », rayon, pixel, fr)
2. ├─base::withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
3. └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
4. └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
5. └─`_fseq`(`_lhs`)
6. └─magrittr::freduce(value, `_function_list`)
7. ├─base::withVisible(function_list[[k]](value))
8. └─function_list[[k]](value)
9. └─global::lissage(., « deces », rayon, pixel, fr)
10. └─`%>%`(…)
11. ├─base::withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
12. └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
13. └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
xecution halted
« `
Après avoir changer la ligne 78 en :
`as_tibble(.name_repair = ~c(« X », « Y »)) %>%`, j’obtiens :
The following objects are masked from ‘package:stats’:
chisq.test, fisher.test
Attaching package: ‘glue’
The following object is masked from ‘package:dplyr’:
collapse
Linking to ImageMagick 6.9.10.23
Enabled features: fontconfig, freetype, fftw, lcms, pango, webp, x11
Disabled features: cairo, ghostscript, rsvg
Using ‘,’ as decimal and ‘.’ as grouping mark. Use read_delim() for more control.
Parsed with column specification:
cols(
dep = col_character(),
sexe = col_double(),
jour = col_date(format = « »),
hosp = col_double(),
rea = col_double(),
rad = col_double(),
dc = col_double()
)
New names:
* « -> …1
* « -> …2
Warning message:
In st_point_on_surface.sf(.) :
st_point_on_surface assumes attributes are constant over geometries of x
reprojecting data…
reprojecting study zone…
generating reference grid…
computing kernel…
Note: Using an external vector in selections is ambiguous.
ℹ Use `all_of(field)` instead of `field` to silence this message.
ℹ See .
This message is displayed once per session.
Error: Assigned data `(1:nrow(dtCentroidesUniques)) – 1L` must be compatible with existing data.
✖ Existing data has 0 rows.
✖ Assigned data has 2 rows.
ℹ Only vectors of size 1 are recycled.
Backtrace:
█
1. └─covid_geo_pop %>% lissage(« deces », rayon, pixel, fr)
2. ├─base::withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
3. └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
4. └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
5. └─`_fseq`(`_lhs`)
6. └─magrittr::freduce(value, `_function_list`)
7. ├─base::withVisible(function_list[[k]](value))
8. └─function_list[[k]](value)
9. └─global::lissage(., « deces », rayon, pixel, fr)
10. └─`%>%`(…)
11. ├─base::withVisible(eval(quote(`_fseq`(`
Execution halted
« `
Un problème de version ?
Merci pour l’aide
tous les paquets sont installés ?
tidyverse httr fs sf readxl janitor glue tmap grid classInt magick
mais aussi
btb raster fasterize plyr
The following object is masked from ‘package:graphics’:
plot
> require(« plyr »)
Loading required package: plyr
——————————————————————————
You have loaded plyr after dplyr – this is likely to cause problems.
If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
library(plyr); library(dplyr)
——————————————————————————
Attaching package: ‘plyr’
The following objects are masked from ‘package:dplyr’:
En gros, qu’est-ce que fais le code pour obtenir le lissage à une date donnée ? On colorie d’abord les départements avec leur couleur puis on applique une fonction de lissage ?
On crée une grille pour la France, puis on génère les « centroïdes » des départements contenant le champ numérique à lisser et on utilise btb pour faire le lissage des points sur la grille.
[…] will again use the same COVID-19 dataset. We manually add the overseas départements once we have found the right grid (by […]
13 réponses sur « COVID-19 decease animation map »
[…] by data_admin [This article was first published on r.iresmi.net, and kindly contributed to R-bloggers]. (You can report issue about the content on this page […]
[…] See also the animated map. […]
Hello,
it’s very interesting, thanks. Could you please do the same animated GIF but with the 1st column « incid_hosp » of the file below which gives the number of NEW COVID19 hospitalizations per day and by department, which would be even more interesting I think. We could thus see the progression and the decrease of the epidemic. Thank you
https://www.data.gouv.fr/fr/datasets/r/6fadff46-9efd-4c53-942a-54aca783c30c
OK, c’est 700 € la journée ; toute journée commencée est due.
(sinon le code est disponible ci-dessus)
:-/
[…] Creating the grid and conserving minimal topological relations and the general shape can be time consuming, but thanks to Geogrid it’s quite easy. The geogrid dev page provides nice examples. We will reuse our code of the COVID19 animation. […]
Bonjour, j’ai installé R 3.6.3 (je connais pas R), quand je lance le code avec `Rscript`, j’obtiens :
« `
Linking to ImageMagick 6.9.10.23
Enabled features: fontconfig, freetype, fftw, lcms, pango, webp, x11
Disabled features: cairo, ghostscript, rsvg
Using ‘,’ as decimal and ‘.’ as grouping mark. Use read_delim() for more control.
Parsed with column specification:
cols(
dep = col_character(),
sexe = col_double(),
jour = col_date(format = « »),
hosp = col_double(),
rea = col_double(),
rad = col_double(),
dc = col_double()
)
New names:
* « -> …1
* « -> …2
Warning message:
In st_point_on_surface.sf(.) :
st_point_on_surface assumes attributes are constant over geometries of x
reprojecting data…
reprojecting study zone…
generating reference grid…
Error: Columns 1 and 2 must be named.
Backtrace:
█
1. └─covid_geo_pop %>% lissage(« deces », rayon, pixel, fr)
2. ├─base::withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
3. └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
4. └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
5. └─`_fseq`(`_lhs`)
6. └─magrittr::freduce(value, `_function_list`)
7. ├─base::withVisible(function_list[[k]](value))
8. └─function_list[[k]](value)
9. └─global::lissage(., « deces », rayon, pixel, fr)
10. └─`%>%`(…)
11. ├─base::withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
12. └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
13. └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
xecution halted
« `
Après avoir changer la ligne 78 en :
`as_tibble(.name_repair = ~c(« X », « Y »)) %>%`, j’obtiens :
« `
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
✔ ggplot2 3.3.0 ✔ purrr 0.3.4
✔ tibble 3.0.1 ✔ dplyr 0.8.5
✔ tidyr 1.1.0 ✔ stringr 1.4.0
✔ readr 1.3.1 ✔ forcats 0.5.0
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
Linking to GEOS 3.8.1, GDAL 3.0.4, PROJ 7.0.1
Attaching package: ‘janitor’
The following objects are masked from ‘package:stats’:
chisq.test, fisher.test
Attaching package: ‘glue’
The following object is masked from ‘package:dplyr’:
collapse
Linking to ImageMagick 6.9.10.23
Enabled features: fontconfig, freetype, fftw, lcms, pango, webp, x11
Disabled features: cairo, ghostscript, rsvg
Using ‘,’ as decimal and ‘.’ as grouping mark. Use read_delim() for more control.
Parsed with column specification:
cols(
dep = col_character(),
sexe = col_double(),
jour = col_date(format = « »),
hosp = col_double(),
rea = col_double(),
rad = col_double(),
dc = col_double()
)
New names:
* « -> …1
* « -> …2
Warning message:
In st_point_on_surface.sf(.) :
st_point_on_surface assumes attributes are constant over geometries of x
reprojecting data…
reprojecting study zone…
generating reference grid…
computing kernel…
Note: Using an external vector in selections is ambiguous.
ℹ Use `all_of(field)` instead of `field` to silence this message.
ℹ See .
This message is displayed once per session.
Error: Assigned data `(1:nrow(dtCentroidesUniques)) – 1L` must be compatible with existing data.
✖ Existing data has 0 rows.
✖ Assigned data has 2 rows.
ℹ Only vectors of size 1 are recycled.
Backtrace:
█
1. └─covid_geo_pop %>% lissage(« deces », rayon, pixel, fr)
2. ├─base::withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
3. └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
4. └─base::eval(quote(`_fseq`(`_lhs`)), env, env)
5. └─`_fseq`(`_lhs`)
6. └─magrittr::freduce(value, `_function_list`)
7. ├─base::withVisible(function_list[[k]](value))
8. └─function_list[[k]](value)
9. └─global::lissage(., « deces », rayon, pixel, fr)
10. └─`%>%`(…)
11. ├─base::withVisible(eval(quote(`_fseq`(`
Execution halted
« `
Un problème de version ?
Merci pour l’aide
tous les paquets sont installés ?
tidyverse httr fs sf readxl janitor glue tmap grid classInt magick
mais aussi
btb raster fasterize plyr
oui, je crois
> require(« tidyverse »)
Loading required package: tidyverse
── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
✔ ggplot2 3.3.0 ✔ purrr 0.3.4
✔ tibble 3.0.1 ✔ dplyr 0.8.5
✔ tidyr 1.1.0 ✔ stringr 1.4.0
✔ readr 1.3.1 ✔ forcats 0.5.0
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
> require(« httr »)
Loading required package: httr
> require(« fs »)
Loading required package: fs
> require(« sf »)
Loading required package: sf
Linking to GEOS 3.8.1, GDAL 3.0.4, PROJ 7.0.1
> require(« readxl »)
Loading required package: readxl
> require(« janitor »)
Loading required package: janitor
Attaching package: ‘janitor’
The following objects are masked from ‘package:stats’:
chisq.test, fisher.test
> require(« glue »)
Loading required package: glue
Attaching package: ‘glue’
The following object is masked from ‘package:dplyr’:
collapse
> require(« tmap »)
Loading required package: tmap
> require(« grid »)
Loading required package: grid
> require(« classInt »)
Loading required package: classInt
> require(« magick »)
Loading required package: magick
Linking to ImageMagick 6.9.10.23
Enabled features: fontconfig, freetype, fftw, lcms, pango, webp, x11
Disabled features: cairo, ghostscript, rsvg
> require(« btb »)
Loading required package: btb
> require(« raster »)
Loading required package: raster
Loading required package: sp
Attaching package: ‘raster’
The following object is masked from ‘package:glue’:
trim
The following object is masked from ‘package:janitor’:
crosstab
The following object is masked from ‘package:dplyr’:
select
The following object is masked from ‘package:tidyr’:
extract
> require(« fasterize »)
Loading required package: fasterize
Attaching package: ‘fasterize’
The following object is masked from ‘package:graphics’:
plot
> require(« plyr »)
Loading required package: plyr
——————————————————————————
You have loaded plyr after dplyr – this is likely to cause problems.
If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
library(plyr); library(dplyr)
——————————————————————————
Attaching package: ‘plyr’
The following objects are masked from ‘package:dplyr’:
arrange, count, desc, failwith, id, mutate, rename, summarise,
summarize
The following object is masked from ‘package:purrr’:
compact
>
Je ne vois pas. Il semble que le message vienne de la fonction btb::kernelSmoothing().
C’est le même jeu de donnée ?
Pas grave merci quand même. Pour les données ça devrait être les mêmes oui, sauf pour https://www.data.gouv.fr/fr/datasets/r/63352e38-d353-4b54-bfd1-f1b3ee1cabd7 qui est mis à jour régulièrement
En gros, qu’est-ce que fais le code pour obtenir le lissage à une date donnée ? On colorie d’abord les départements avec leur couleur puis on applique une fonction de lissage ?
On crée une grille pour la France, puis on génère les « centroïdes » des départements contenant le champ numérique à lisser et on utilise btb pour faire le lissage des points sur la grille.
[…] will again use the same COVID-19 dataset. We manually add the overseas départements once we have found the right grid (by […]