--- title: "README" author: "Isabelle Boulangeat" date: "25/01/2021" output: html_document: keep_md: yes variant: markdown_github editor_options: chunk_output_type: console always_allow_html: true --- ```{r setup, include=FALSE} library(knitr) # library(kableExtra) knitr::opts_chunk$set(echo = TRUE) # library(Jmisc) library(tidyr) sapply(list.files("R_fct"), function(x)source(paste0("R_fct/",x))) data = readRDS("data.rds") ``` ```{r ,fig=TRUE} dat_h_veg = merge(data$h, data$sites[,c("id_site", "ref_typoveg")], by.x = "ref_site", by.y ="id_site") library(dplyr) library(tidyr) library(ggplot2) dat_long <- dat_h_veg %>% select(hmean, hmad, ref_typoveg) %>% drop_na() %>% group_by(ref_typoveg) %>% summarize(hauteur=mean(hmean), var_inter=mad(hmean), var_intra = mean(hmad)) %>% gather(stat, value, hauteur:var_intra) ggplot(dat_long, aes(fill=stat, x=ref_typoveg, y=value)) + geom_bar(position = "dodge", stat = "identity") + facet_wrap(~stat, ncol = 1, scales = "free") ```