#' gg_built
#'
#' Ajoute à x le texte pour l'identification des outliers + ses coordonnées
#'
#' @param x data.
#' @param p graphique créé par 'dotplot1()'.
#'
#' @import ggplot2
#' @import data.table
#' @keywords internal
#' @export
gg_built <- function(x, p){
built <- ggplot_build(p)$data[[1]] %>% # paramètres d'affichage du graphe
select(xcoord = x, ycoord = ymax) %>% # coordonnées nécessaires
as.data.table()
x <- cbind(x, built) # ajout au tableau d'analyse
x[, dotnum := ""]
x[Outlier == "Oui", dotnum := paste(sort(region), collapse = ", "), .(xcoord)] # liste des regions
return(x)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.