#' Plot a turfeffect object for socioeconomic indicators
#'
#' @param model An object of class lm, generated by the turfeffect() function or extracted from the tibble output of the bio_results() function
#' @param y.lab A character that specifies the y label
#'
#' @return an object of class ggplot2
#' @export
#'
soc_plot <- function(data, y.lab = "Value"){
library(ggplot2)
library(dplyr)
library(tidyr)
p <- data %>%
mutate(Ano = as.numeric(as.character(Ano))) %>%
ggplot(aes(x = Ano, y = Indicador)) +
stat_summary(geom = "line", fun.y = mean) +
stat_summary(geom = "point", fun.y = mean, size = 3, aes(color = Post)) +
theme_bw() +
labs(x = "Ano", y = y.lab) +
scale_color_brewer(palette = "Set1", direction = -1)
return(p)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.