README.Rmd 1007 Bytes
Newer Older
Boulangeat Isabelle's avatar
Boulangeat Isabelle committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
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")
```