--- 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") data$otable[which(is.na(data$otable$hauteur)),] dat_h_veg = unique(merge(data$h, data$sites[,c("id_site", "ref_typoveg")], by.x = "ref_site", by.y ="id_site")) length(unique(dat_h_veg$releve)) dim(dat_h_veg) summary(dat_h_veg$hmean) #============================== library(dplyr) # library(reshape) library(tidyr) library(ggplot2) ``` ```{r ,fig=TRUE} 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") ``` ```{r ,fig=TRUE} ## boxplot par milieu ## ggplot(dat_h_veg, aes(x = reorder(ref_typoveg, hmean, na.rm=TRUE), y = hmean)) + geom_boxplot() + labs(y="Hauteur moyenne (est. biomasse)", x="Type vegetation") ``` ```{r ,fig=TRUE} ## H series par milieu ## pl <- ggplot(dat_h_veg, aes(x = date_releve, y = hmean)) + geom_line(aes(color = ref_site), show.legend = FALSE) + facet_wrap(~ref_typoveg) pl + theme(legend.position = "none") ``` ```{r ,fig=TRUE} calage = read.csv("../PNE_calage_reformat.csv", sep= ";", dec = ",") head(calage) str(calage) calage$releve = paste0(calage$site, calage$Releveur) cal_mean = unique(calage %>% group_by(releve) %>% summarize(site = site, hmean = mean(hauteur, na.rm=TRUE))) ggplot(cal_mean, aes(x = reorder(site, hmean), y = hmean)) + geom_boxplot() + geom_point() obs_error = cal_mean %>% group_by(site) %>% summarize(hmad = mad(hmean), hmad_st = mad(hmean)/mean(hmean), hm = mean(hmean)) ``` ```{r ,fig=TRUE} ggplot(obs_error, aes(x = reorder(site, hm), y = hmad_st)) + geom_bar(stat = "identity") ``` ```{r ,fig=TRUE} ### sd vs mad ggplot(dat_h_veg, aes(x = hmad, y = hsd)) + geom_point() ``` ```{r ,fig=TRUE} ### dans le temps ggplot(dat_h_veg, aes(x = date_releve, y = hmad)) + geom_line(aes(color = ref_site), show.legend = FALSE) + facet_wrap(~ref_typoveg) ## boxplot par milieu ## ``` ```{r ,fig=TRUE} ggplot(dat_h_veg, aes(x = reorder(ref_typoveg, hmad, na.rm=TRUE), y = hmad)) + geom_boxplot() + labs(y="Variation intra de hauteur", x="Type vegetation") ``` ```{r ,fig=TRUE} ggplot(dat_h_veg, aes(x = reorder(ref_typoveg, hmad/hmean, na.rm=TRUE), y = hmad/hmean)) + geom_boxplot() + labs(y="Variation intra de hauteur (stand. moy.)", x="Type vegetation") ```