comparison div_index.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 b67730406f1b
children
comparison
equal deleted inserted replaced
1:b67730406f1b 2:bcbad4f83dec
8 ## ## 8 ## ##
9 ############################### 9 ###############################
10 10
11 #####Packages : dplyr 11 #####Packages : dplyr
12 # tidyr 12 # tidyr
13 # readr
14 # writexl
15 # stringr
16 # readxl
17 # tibble
18 # lubridate
19 # cowplot
20 # magrittr
21 # rmarkdown
22 library(magrittr)
23 library(dplyr)
24 #####Load arguments 13 #####Load arguments
25 14
26 args <- commandArgs(trailingOnly = TRUE) 15 args <- commandArgs(trailingOnly = TRUE)
27 16
28 #####Import data 17 #####Import data
104 93
105 qecnato0$period <- as.character(qecnato0$period) 94 qecnato0$period <- as.character(qecnato0$period)
106 qecnato0$Face <- as.character(qecnato0$Face) 95 qecnato0$Face <- as.character(qecnato0$Face)
107 96
108 div_list <- vector("list", length(unique(qecnato0$site_year_month_day))) 97 div_list <- vector("list", length(unique(qecnato0$site_year_month_day)))
109 98 library(dplyr)
110 for (i in c(1:nrow(qecnato0))) { 99 for (i in c(1:nrow(qecnato0))) {
111 div_i <- dplyr::filter(qecnato0, site_year_month_day == qecnato0$site_year_month_day[i]) 100 div_i <- dplyr::filter(qecnato0, site_year_month_day == qecnato0$site_year_month_day[i])
112 101
113 ifelse(unique(div_i$region) == "Bretagne", var. <- c(bret_egmp_basq_qecb), var. <- c(bret_egmp_basq_qecb, egmp_basq_qecb)) # Qu. : Why can't R's ifelse statements return vectors? => you can circumvent the problem if you assign the result inside the ifelse. 102 ifelse(unique(div_i$region) == "Bretagne", var. <- c(bret_egmp_basq_qecb), var. <- c(bret_egmp_basq_qecb, egmp_basq_qecb)) # Qu. : Why can't R's ifelse statements return vectors? => you can circumvent the problem if you assign the result inside the ifelse.
114 103