diff --git a/geau/DESCRIPTION b/geau/DESCRIPTION index 108a33a4a6c1465d79f9b3274ac7490a894c454a..c688320a42ea6733315f4c9e9ab75fff85a162be 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.14.0 +Version: 1.0.15.0 Authors@R: c( person(given = "Frédéric", @@ -23,6 +23,7 @@ LazyData: true Imports: kableExtra, knitr, + readODS, rio, scales, sf, diff --git a/geau/NAMESPACE b/geau/NAMESPACE index f4d57d02574fc4c75a14bf7043817f4494019914..879c502667d927b550a42a28cb2a3e6522914ca4 100644 --- a/geau/NAMESPACE +++ b/geau/NAMESPACE @@ -3,5 +3,6 @@ export(add.inset) export(current_version) export(estimate_catnat_freq) +export(format_presence) export(kable_units) export(map_so_ii) diff --git a/geau/R/format_presence.R b/geau/R/format_presence.R new file mode 100644 index 0000000000000000000000000000000000000000..87954fc3effb7b5b5e9b23133cbae143af6daf57 --- /dev/null +++ b/geau/R/format_presence.R @@ -0,0 +1,17 @@ +#' @title Transform ods table presence in md table (for Mattermost) +#' +#' @param x character or data.frame, path of the ods table or the table itself +#' +#' @return character, md version of table behind x. +#' +#' @export +#' +#' @encoding UTF-8 +#' @author Frédéric Grelot + +format_presence = function(x) { + result = if (is.character(x)) readODS::read_ods(x[1]) else x + result[] = lapply(result, gsub, pattern = "B", replacement = "**B**") + result[] = lapply(result, gsub, pattern = "C", replacement = "*C*") + knitr::kable(result, align = c("l", rep("c", length(result) - 1))) +} diff --git a/geau/R/map_so_ii.r b/geau/R/map_so_ii.r index b86b5c9103042e490a8c05f1444a679c243f7bd9..a053910ddece453cefc090d4b3e3acce84f60338 100644 --- a/geau/R/map_so_ii.r +++ b/geau/R/map_so_ii.r @@ -122,7 +122,7 @@ map_so_ii = function( ## Init map graphics::par(mai = c(.65, .60, .50, .15)) - plot(geau::so_ii_limit, axes = TRUE) + plot(geau::so_ii_limit, axes = TRUE, main = list(...)[["main"]], cex.main = 3) ## Plot theme if any, return theme_legend theme_legend = switch( diff --git a/geau/man/format_presence.Rd b/geau/man/format_presence.Rd new file mode 100644 index 0000000000000000000000000000000000000000..ca96940ebe6aca13e966d64056b0e0175bf22fdc --- /dev/null +++ b/geau/man/format_presence.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/presence.R +\encoding{UTF-8} +\name{format_presence} +\alias{format_presence} +\title{Transform ods table presence in md table (for Mattermost)} +\usage{ +format_presence(x) +} +\arguments{ +\item{x}{character or data.frame, path of the ods table or the table itself} +} +\value{ +character, md version of table behind x. +} +\description{ +Transform ods table presence in md table (for Mattermost) +} +\author{ +Frédéric Grelot +}