From 59028e4235f67fd71ddac6ae54f29499d56fea21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Grelot?= <frederic.grelot@irstea.fr> Date: Sat, 22 Jan 2022 12:07:10 +0100 Subject: [PATCH] =?UTF-8?q?geau=20Version=201.0.6.1=200=20errors=20?= =?UTF-8?q?=E2=9C=94=20|=200=20warnings=20=E2=9C=94=20|=200=20notes=20?= =?UTF-8?q?=E2=9C=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - map_so_ii -- Correction de "bugs" - mettre un numeric en year pour le theme population ne génère plus d'erreurs - year est vérifié sur les données pour theme population & catnat --- geau/DESCRIPTION | 2 +- geau/R/map_so_ii.r | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/geau/DESCRIPTION b/geau/DESCRIPTION index f5e3174..168cad4 100644 --- a/geau/DESCRIPTION +++ b/geau/DESCRIPTION @@ -1,6 +1,6 @@ Package: geau Title: Utilities very useful to share within geau-inondation team -Version: 1.0.6.0 +Version: 1.0.6.1 Authors@R: c( person(given = "Frédéric", diff --git a/geau/R/map_so_ii.r b/geau/R/map_so_ii.r index 66e247c..d165283 100644 --- a/geau/R/map_so_ii.r +++ b/geau/R/map_so_ii.r @@ -159,6 +159,10 @@ map_so_ii = function( if (missing(year)) { year = utils::tail(sort(colnames(geau::so_ii_population)), 1) } + year = match.arg( + as.character(year), + sort(colnames(geau::so_ii_population)) + ) population_palette = scales::colour_ramp(c("white", "red"), alpha = .5) color = matrix( scales::cscale( @@ -212,9 +216,13 @@ map_so_ii = function( border = NA color = NA if (!missing(year)) { + year = match.arg( + as.character(year), + dimnames(geau::so_ii_catnat)[["period"]] + ) border = "grey80" catnat = apply( - geau::so_ii_catnat[, as.character(year), detail, drop = FALSE], + geau::so_ii_catnat[, year, detail, drop = FALSE], 1:2, sum ) -- GitLab