annotate functions.r @ 1:4ed07d2d442b draft default tip

"planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
author ecology
date Fri, 13 Aug 2021 18:16:26 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
1 #Rscript
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
2
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
3 #########################################################################################
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
4 ####################### Exploration data tools function #################################
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
5 #########################################################################################
4ed07d2d442b "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
4ed07d2d442b "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
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
8
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
9 ######################################### start of the function makeTableAnalyse
4ed07d2d442b "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
4ed07d2d442b "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) {
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
12 tab <- reshape(data
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
13 , v.names = var
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
14 , idvar = c(var2, var3)
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
15 , timevar = spe
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
16 , direction = "wide")
4ed07d2d442b "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
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
18
4ed07d2d442b "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 ""
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
20 return(tab)
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
21 }
4ed07d2d442b "planemo upload for repository https://github.com/Marie59/Data_explo_tools commit 60627aba07951226c8fd6bb3115be4bd118edd4e"
ecology
parents:
diff changeset
22 ######################################### end of the function makeTableAnalyse