Mercurial > repos > ecology > cb_ivr
annotate cb_ivr.r @ 2:bcbad4f83dec draft default tip
planemo upload for repository https://github.com/Marie59/champ_blocs commit 075fd90d1a39ae7912b48549e5537971635b9620
author | ecology |
---|---|
date | Sat, 18 Mar 2023 16:49:19 +0000 |
parents | 8c6142630659 |
children |
rev | line source |
---|---|
0
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
1 # author: "Jonathan Richir" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
2 # date: "19 April 2021" ) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
3 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
4 #Rscript |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
5 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
6 ############################### |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
7 ## ## |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
8 ############################### |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
9 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
10 #####Packages : dplyr |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
11 # tidyr |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
12 # readr |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
13 # writexl |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
14 # stringr |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
15 # readxl |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
16 # tibble |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
17 # lubridate |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
18 # cowplot |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
19 # magrittr |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
20 # rmarkdown |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
21 library(magrittr) |
2
bcbad4f83dec
planemo upload for repository https://github.com/Marie59/champ_blocs commit 075fd90d1a39ae7912b48549e5537971635b9620
ecology
parents:
0
diff
changeset
|
22 library(gmp) |
0
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
23 #####Load arguments |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
24 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
25 args <- commandArgs(trailingOnly = TRUE) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
26 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
27 ### Import data |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
28 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
29 if (length(args) < 1) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
30 stop("This tool needs at least 1 argument") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
31 }else { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
32 fiche_val <- args[1] |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
33 input_data <- args[2] |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
34 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
35 } |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
36 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
37 ############################################################# |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
38 # # |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
39 # Load and clean the data # |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
40 # # |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
41 ############################################################# |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
42 ### load ivr data |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
43 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
44 ivr <- read.csv2(input_data, header = FALSE, fileEncoding = "Latin1") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
45 names_ <- as.vector(unlist(ivr[1, ])) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
46 names_ <- gsub(" ", ".", names_) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
47 colnames(ivr) <- names_ |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
48 ivr <- ivr[-1, ] |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
49 ivr <- ivr[, -17] |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
50 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
51 # NB inversion between id and ID.Fiche variable names |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
52 ivr <- dplyr::rename(ivr, XX = ID.Fiche) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
53 ivr <- dplyr::rename(ivr, ID.Fiche = id) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
54 ivr <- dplyr::rename(ivr, id = XX) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
55 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
56 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
57 ### load excel files "Fiche terrain" the metadata |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
58 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
59 fiche <- read.csv2(fiche_val, fileEncoding = "Latin1") # fileEncoding = "Latin1" cfr é in variable names |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
60 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
61 date_fiche <- as.Date(stringr::str_sub(fiche$date.sortie, end = 10), origin = "1970-01-01") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
62 fiche <- tibble::add_column(fiche, date_fiche, .after = "date.sortie") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
63 rm(date_fiche) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
64 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
65 ## ivr vs fiche terrain |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
66 ivr$id <- as.numeric(ivr[, c("id")]) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
67 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
68 fiche_red <- dplyr::filter(fiche, fiche$ID.Fiche %in% unique(ivr[, c("id")])) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
69 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
70 id_count <- ivr %>% dplyr::group_by(id) %>% dplyr::count() |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
71 id_count <- dplyr::rename(id_count, "ID.Fiche" = "id") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
72 id_count <- dplyr::ungroup(id_count) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
73 id_count <- as.data.frame(id_count) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
74 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
75 fiche_red <- dplyr::left_join(fiche_red, id_count) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
76 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
77 # rep fiche terrain information |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
78 fiche_expanded <- fiche_red[rep(row.names(fiche_red), fiche_red$n), 1:ncol(fiche_red)] |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
79 fiche_expanded <- dplyr::rename(fiche_expanded, "id" = "ID.Fiche") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
80 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
81 ## merge ivr data and ficheterrain information |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
82 ivr <- dplyr::bind_cols(ivr, fiche_expanded) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
83 ivr <- dplyr::rename(ivr, "id.ivr" = "id...1") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
84 ivr <- dplyr::rename(ivr, "id.fiche" = "id...17") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
85 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
86 rm(fiche_expanded, fiche_red, id_count) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
87 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
88 ivr <- ivr %>% tidyr::separate(date_fiche, c("Year", "Month", "Day"), sep = "-", remove = FALSE) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
89 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
90 ## I create two new variables for Site names, one for data analysis and one for data reporting. Only works for actual ivr df with 22 sites ! |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
91 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
92 # Name for data analysis |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
93 ivr <- tibble::add_column(ivr, Site = ivr$zone.habitat, .after = "ID.Fiche") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
94 ivr$Site <- gsub(pattern = " \\(champ de blocs\\)", replacement = "", ivr$Site) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
95 ivr$Site <- gsub(pattern = " \\(champ blocs\\)", replacement = "", ivr$Site) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
96 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
97 for (x in seq_along(ivr$Site)) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
98 if (grepl(pattern = "Locmariaquer", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
99 ivr$Site[x] <- "GDMO_Locmariaquer" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
100 } else if (grepl(pattern = "Beg Lann", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
101 ivr$Site[x] <- "GDMO_BegLann" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
102 } else if (grepl(pattern = "Plateau du Four", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
103 ivr$Site[x] <- "FOUR_PlateauFour" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
104 } else if (grepl(pattern = "Grouin", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
105 ivr$Site[x] <- "EGMP_GroinCou" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
106 } else if (grepl(pattern = "Ensembert", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
107 ivr$Site[x] <- "EGMP_PasEmsembert" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
108 } else if (grepl(pattern = "Brée-les-Bains", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
109 ivr$Site[x] <- "EGMP_BreeBains" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
110 } else if (grepl(pattern = "Antiochat", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
111 ivr$Site[x] <- "EGMP_PerreAntiochat" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
112 } else if (grepl(pattern = "Chassiron", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
113 ivr$Site[x] <- "EGMP_Chassiron" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
114 } else if (grepl(pattern = "zone p", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
115 ivr$Site[x] <- "BASQ_FlotsBleusZP" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
116 } else if (grepl(pattern = "zone f", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
117 ivr$Site[x] <- "BASQ_FlotsBleusZF" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
118 } else if (grepl(pattern = "Saint-Michel", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
119 ivr$Site[x] <- "GONB_IlotStMichel" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
120 } else if (grepl(pattern = "Quéménès", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
121 ivr$Site[x] <- "FINS_Quemenes" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
122 } else if (grepl(pattern = "Goulenez", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
123 ivr$Site[x] <- "FINS_SeinGoulenez" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
124 } else if (grepl(pattern = "Kilaourou", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
125 ivr$Site[x] <- "FINS_SeinKilaourou" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
126 } else if (grepl(pattern = "Verdelet", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
127 ivr$Site[x] <- "ARMO_Verdelet" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
128 } else if (grepl(pattern = "Piégu", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
129 ivr$Site[x] <- "ARMO_Piegu" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
130 } else if (grepl(pattern = "Bilfot", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
131 ivr$Site[x] <- "ARMO_Bilfot" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
132 } else if (grepl(pattern = "Plate", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
133 ivr$Site[x] <- "ARMO_IlePlate" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
134 } else if (grepl(pattern = "Perharidy", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
135 ivr$Site[x] <- "PDMO_Perharidy" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
136 } else if (grepl(pattern = "Keraliou", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
137 ivr$Site[x] <- "BRES_Keraliou" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
138 } else if (grepl(pattern = "Mousterlin", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
139 ivr$Site[x] <- "FINS_Mousterlin" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
140 } else if (grepl(pattern = "Nicolas", ivr$Site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
141 ivr$Site[x] <- "FINS_StNicolasGlenan" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
142 } |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
143 if (grepl(pattern = "Roz", ivr$site[x]) == TRUE) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
144 ivr$Site[x] <- "FINS_AnseRoz" |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
145 } |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
146 } |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
147 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
148 # Name for report/plot |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
149 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
150 ivr <- tibble::add_column(ivr, Site_bis = ivr$Site, .after = "Site") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
151 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
152 ivr$Site_bis <- ifelse(ivr$Site == "GDMO_Locmariaquer", "Locmariaquer", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
153 ivr$Site_bis <- ifelse(ivr$Site == "GDMO_BegLann", "Beg Lann", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
154 ivr$Site_bis <- ifelse(ivr$Site == "FOUR_PlateauFour", "Plateau du Four", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
155 ivr$Site_bis <- ifelse(ivr$Site == "EGMP_GroinCou", "Grouin du Cou", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
156 ivr$Site_bis <- ifelse(ivr$Site == "EGMP_PasEmsembert", "Le Pas d'Emsembert", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
157 ivr$Site_bis <- ifelse(ivr$Site == "EGMP_BreeBains", "La Brée-les-Bains", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
158 ivr$Site_bis <- ifelse(ivr$Site == "EGMP_PerreAntiochat", "Le Perré d'Antiochat", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
159 ivr$Site_bis <- ifelse(ivr$Site == "EGMP_Chassiron", "Chassiron", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
160 ivr$Site_bis <- ifelse(ivr$Site == "BASQ_FlotsBleusZP", "Les Flots Bleus / zone pêcheurs", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
161 ivr$Site_bis <- ifelse(ivr$Site == "BASQ_FlotsBleusZF", "Les Flots Bleus / zone familles", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
162 ivr$Site_bis <- ifelse(ivr$Site == "GONB_IlotStMichel", "Îlot Saint-Michel", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
163 ivr$Site_bis <- ifelse(ivr$Site == "FINS_Quemenes", "Quéménès", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
164 ivr$Site_bis <- ifelse(ivr$Site == "FINS_SeinGoulenez", "Île de Sein - Goulenez", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
165 ivr$Site_bis <- ifelse(ivr$Site == "FINS_SeinKilaourou", "Île de Sein - Kilaourou", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
166 ivr$Site_bis <- ifelse(ivr$Site == "ARMO_Verdelet", "Îlot du Verdelet", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
167 ivr$Site_bis <- ifelse(ivr$Site == "ARMO_Piegu", "Piégu", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
168 ivr$Site_bis <- ifelse(ivr$Site == "ARMO_Bilfot", "Pointe de Bilfot", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
169 ivr$Site_bis <- ifelse(ivr$Site == "ARMO_IlePlate", "Île Plate", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
170 ivr$Site_bis <- ifelse(ivr$Site == "PDMO_Perharidy", "Perharidy", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
171 ivr$Site_bis <- ifelse(ivr$Site == "BRES_Keraliou", "Keraliou", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
172 ivr$Site_bis <- ifelse(ivr$Site == "FINS_Mousterlin", "Pointe de Mousterlin", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
173 ivr$Site_bis <- ifelse(ivr$Site == "FINS_StNicolasGlenan", "Saint-Nicolas des Glénan", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
174 ivr$Site_bis <- ifelse(ivr$Site == "FINS_AnseRoz", "Pointe de l'Anse du Roz", ivr$Site_bis) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
175 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
176 ## change some variable format to integer |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
177 ivr$Nb.Blocs.Non.Retournes <- as.integer(ivr$Nb.Blocs.Non.Retournes) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
178 ivr$Nb.Blocs.Retournes <- as.integer(ivr$Nb.Blocs.Retournes) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
179 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
180 ivr$Year <- as.integer(ivr$Year) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
181 ivr$Month <- as.integer(ivr$Month) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
182 ivr$Day <- as.integer(ivr$Day) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
183 ivr$Numero.Quadrat <- as.integer(ivr$Numero.Quadrat) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
184 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
185 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
186 ## save the final, commplete ivr df. |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
187 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
188 ivr <- ivr[, c(19:54, 1:18)] |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
189 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
190 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
191 ## percentage of unturned vs overturned boulders and IVR previous 0-5 discrete scale values calculation |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
192 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
193 # create two new variables first |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
194 site_year_month_day <- paste0(ivr$Site, ".", gsub("-", ".", as.character(ivr$date_fiche))) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
195 ivr <- tibble::add_column(ivr, site_year_month_day, .after = "Site_bis") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
196 rm(site_year_month_day) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
197 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
198 site_year_month_day_qdnb <- paste0(ivr$Site, ".", gsub("-", ".", as.character(ivr$Date)), ".", ivr$Numero.Quadrat) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
199 ivr <- tibble::add_column(ivr, site_year_month_day_qdnb, .after = "site_year_month_day") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
200 rm(site_year_month_day_qdnb) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
201 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
202 ivr <- dplyr::arrange(ivr, Site, Year, Month, Numero.Quadrat) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
203 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
204 # remove data with NA value for Nb.Blocs.Retournes & Nb.Blocs.Non.Retournes |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
205 ivr_naomit <- ivr %>% dplyr::filter(!is.na(ivr$Nb.Blocs.Retournes)) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
206 ivr_naomit <- as.data.frame(ivr_naomit) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
207 colnames(ivr_naomit) <- colnames(ivr) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
208 ivr_naomit <- ivr_naomit %>% dplyr::filter(!is.na(ivr_naomit$Nb.Blocs.Non.Retournes)) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
209 ivr_naomit <- as.data.frame(ivr_naomit) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
210 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
211 # also remove data with Nb.Blocs.Retournes = 0 & Nb.Blocs.Non.Retournes = 0, cfr equivalent to quadrat with no boulders ... makes no sense to consider quadrat without boulder for ivr determination. |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
212 ivr_rm <- dplyr::filter(ivr_naomit, ivr_naomit$Nb.Blocs.Retournes == 0 && ivr_naomit$Nb.Blocs.Non.Retournes == 0) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
213 ivr_naomit <- ivr_naomit %>% dplyr::anti_join(ivr_rm) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
214 rm(ivr_rm) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
215 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
216 ivr_val_qu_ <- ivr_naomit |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
217 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
218 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
219 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
220 ############################################################# |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
221 # # |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
222 # Calcul of the IVR # |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
223 # # |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
224 ############################################################# |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
225 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
226 ### Percentage of turned boulder |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
227 for (i in 1:nrow(ivr_naomit)) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
228 (bm <- sum(ivr_naomit$Nb.Blocs.Non.Retournes[i], ivr_naomit$Nb.Blocs.Retournes[i])) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
229 (ivr_val_qu_$blocs.retournes.fr.[i] <- (ivr_naomit$Nb.Blocs.Retournes[i] / bm) * 100) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
230 (ivr_val_qu_$blocs.non.retournes.fr.[i] <- (ivr_naomit$Nb.Blocs.Non.Retournes[i] / bm) * 100) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
231 } |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
232 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
233 rm(bm, i) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
234 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
235 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
236 ivr_val_qu_$blocs.non.retournes.fr. <- ifelse(is.nan(ivr_val_qu_$blocs.non.retournes.fr.), NA, ivr_val_qu_$blocs.non.retournes.fr.) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
237 ivr_val_qu_$blocs.retournes.fr. <- ifelse(is.nan(ivr_val_qu_$blocs.retournes.fr.), NA, ivr_val_qu_$blocs.retournes.fr.) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
238 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
239 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
240 # ivr for loop by quadrat. |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
241 for (i in 1:seq_len(nrow(ivr_val_qu_))) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
242 if (ivr_val_qu_$Nb.Blocs.Non.Retournes[i] == 0 && ivr_val_qu_$Nb.Blocs.Retournes[i] == 0) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
243 ivr_ <- NA |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
244 }else { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
245 if (ivr_val_qu_$blocs.retournes.fr.[i] < 5) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
246 ivr_ <- 0 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
247 } else if (ivr_val_qu_$blocs.retournes.fr.[i] >= 5 && ivr_val_qu_$blocs.retournes.fr.[i] < 25) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
248 ivr_ <- 1 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
249 } else if (ivr_val_qu_$blocs.retournes.fr.[i] >= 25 && ivr_val_qu_$blocs.retournes.fr.[i] < 45) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
250 ivr_ <- 2 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
251 } else if (ivr_val_qu_$blocs.retournes.fr.[i] >= 45 && ivr_val_qu_$blocs.retournes.fr.[i] < 65) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
252 ivr_ <- 3 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
253 } else if (ivr_val_qu_$blocs.retournes.fr.[i] >= 65 && ivr_val_qu_$blocs.retournes.fr.[i] < 85) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
254 ivr_ <- 4 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
255 } else { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
256 ivr_ <- 5 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
257 } |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
258 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
259 ivr_val_qu_$valeur.ivr_quadrat[i] <- ivr_ |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
260 } |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
261 } |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
262 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
263 rm(i, ivr_) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
264 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
265 # reorder variables for logical purpose |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
266 ivr_val_qu_ <- ivr_val_qu_[, c(1:56, 58, 57, 59)] |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
267 indic_full <- ivr_val_qu_ |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
268 saveRDS(ivr_val_qu_, "ivr_val_qu.RDS") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
269 rm(ivr_naomit) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
270 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
271 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
272 ## Calculate ivr statistics now |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
273 ivr_val_qu_stat_ <- ivr_val_qu_ %>% dplyr::group_by(id.ivr, Site, Site_bis, Year, Month, Day) %>% dplyr::summarize(ivr_moy = mean(valeur.ivr_quadrat), ivr_et = sd(valeur.ivr_quadrat), ivr_med = median(valeur.ivr_quadrat), ivr_min = min(valeur.ivr_quadrat), ivr_max = max(valeur.ivr_quadrat), fr.r.moy = mean(blocs.retournes.fr.), fr.r.et = sd(blocs.retournes.fr.), fr.r.med = median(blocs.retournes.fr.), fr.r.min = min(blocs.retournes.fr.), fr.r.max = max(blocs.retournes.fr.), fr.nr.moy = mean(blocs.non.retournes.fr.), fr.nr.et = sd(blocs.non.retournes.fr.), fr.nr.med = median(blocs.non.retournes.fr.), fr.nr.min = min(blocs.non.retournes.fr.), fr.nr.max = max(blocs.non.retournes.fr.), nb. = dplyr::n()) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
274 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
275 Date <- as.Date(paste0(ivr_val_qu_stat_$Year, "-", ivr_val_qu_stat_$Month, "-", ivr_val_qu_stat_$Day), origin = "1970-01-01") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
276 ivr_val_qu_stat_ <- tibble::add_column(ivr_val_qu_stat_, Date, .after = "Site_bis") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
277 rm(Date) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
278 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
279 ivr_val_qu_stat_ <- as.data.frame(ivr_val_qu_stat_) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
280 indic <- ivr_val_qu_stat_ |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
281 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
282 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
283 ############################################################# |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
284 # # |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
285 # Plot the IVR per site # |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
286 # # |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
287 ############################################################# |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
288 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
289 ## plot ivr (NB: Year, Month, Day variable names are replace by Annee, Mois, Jour, cfr previous label use in the script) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
290 ivr_val_qu_stat_ <- dplyr::rename(ivr_val_qu_stat_, Annee = Year) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
291 ivr_val_qu_stat_ <- dplyr::rename(ivr_val_qu_stat_, Mois = Month) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
292 ivr_val_qu_stat_ <- dplyr::rename(ivr_val_qu_stat_, Jour = Day) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
293 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
294 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
295 # new IVR scale with continuous 0 to 5 environmental status levels based on % of overturned boulders /20, plus other site data |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
296 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
297 for (i in c(1:length(unique(ivr_val_qu_stat_$Site)))) { |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
298 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
299 ivr_val_eg <- dplyr::filter(ivr_val_qu_stat_, ivr_val_qu_stat_$Site == unique(ivr_val_qu_stat_$Site)[i]) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
300 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
301 ivr_plot <- ggplot2::ggplot() + |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
302 ggplot2::geom_point(ggplot2::aes(x = ivr_val_qu_stat_$Date, y = ivr_val_qu_stat_$fr.r.moy / 20), col = "grey") + |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
303 ggplot2::geom_rect(ggplot2::aes(xmin = min(ivr_val_qu_stat_$Date), xmax = max(ivr_val_qu_stat_$Date), ymin = - 0.5, ymax = 5 / 20, fill = "#FF0000"), alpha = 0.3) + |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
304 ggplot2::geom_rect(ggplot2::aes(xmin = min(ivr_val_qu_stat_$Date), xmax = max(ivr_val_qu_stat_$Date), ymin = 5 / 20, ymax = 25 / 20, fill = "#F59404"), alpha = 0.3) + |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
305 ggplot2::geom_rect(ggplot2::aes(xmin = min(ivr_val_qu_stat_$Date), xmax = max(ivr_val_qu_stat_$Date), ymin = 25 / 20, ymax = 45 / 20, fill = "#FAFA15"), alpha = 0.3) + |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
306 ggplot2::geom_rect(ggplot2::aes(xmin = min(ivr_val_qu_stat_$Date), xmax = max(ivr_val_qu_stat_$Date), ymin = 45 / 20, ymax = 65 / 20, fill = "#18E125"), alpha = 0.3) + |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
307 ggplot2::geom_rect(ggplot2::aes(xmin = min(ivr_val_qu_stat_$Date), xmax = max(ivr_val_qu_stat_$Date), ymin = 65 / 20, ymax = 85 / 20, fill = "#04F5F5"), alpha = 0.3) + |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
308 ggplot2::geom_rect(ggplot2::aes(xmin = min(ivr_val_qu_stat_$Date), xmax = max(ivr_val_qu_stat_$Date), ymin = 85 / 20, ymax = 5.5, fill = "#1A1AE8"), alpha = 0.3) + |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
309 ggplot2::scale_fill_manual(values = c("#F59404", "#FAFA15", "#FF0000", "#04F5F5", "#18E125", "#1A1AE8")) + |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
310 ggplot2::geom_pointrange(ggplot2::aes(x = ivr_val_eg$Date, y = ivr_val_eg$fr.r.moy / 20, ymin = ivr_val_eg$fr.r.moy / 20 - ivr_val_eg$fr.r.et / 20, ymax = ivr_val_eg$fr.r.moy / 20 + ivr_val_eg$fr.r.et / 20), col = "black") + |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
311 ggplot2::xlab("Date") + |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
312 ggplot2::ylab("IVR") + |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
313 ggplot2::ggtitle(unique(ivr_val_eg$Site_bis)) + |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
314 ggplot2::theme(axis.text.x = ggplot2::element_text(angle = 90, vjust = 0.5, hjust = 1), legend.position = "none") |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
315 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
316 ggplot2::ggsave(paste0("ivr_", unique(ivr_val_eg$Site), ".png"), ivr_plot, height = 3, width = 3.5) |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
317 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
318 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
319 } |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
320 |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
321 report <- args[3] |
8c6142630659
planemo upload for repository https://github.com/Marie59/champ_blocs commit 8b6fcddd239979c11977472de6cbb349690758c8
ecology
parents:
diff
changeset
|
322 loop_file <- source(args[4]) |