annotate functions.r @ 1:8e8867bf491a draft default tip

"planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
author ecology
date Fri, 13 Aug 2021 18:18:00 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
1 #Rscript
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
2
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
3 #########################################################################################
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
4 ####################### Exploration data tools function #################################
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
5 #########################################################################################
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
6 #### Based on Romain Lorrillière R script
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
7 #### Modified by Alan Amosse, Benjamin Yguel and Marie Jossé for integrating within Galaxy-E
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
8
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
9 ######################################### start of the function makeTableAnalyse
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
10 ##Species are placed in separated columns and addition of zero on plots where at least one selected species is present
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
11 make_table_analyse <- function(data, var, spe, var2, var3) {
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
12 tab <- reshape(data
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
13 , v.names = var
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
14 , idvar = c(var2, var3)
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
15 , timevar = spe
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
16 , direction = "wide")
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
17 tab[is.na(tab)] <- 0 ###### remplace les na par des 0 / replace NAs by 0
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
18
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
19 colnames(tab) <- sub(paste0(var, "."), "", colnames(tab))### remplace le premier pattern "abond." par le second "" / replace the column names "abond." by ""
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
20 return(tab)
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
21 }
8e8867bf491a "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
22 ######################################### end of the function makeTableAnalyse