diff graph_stat_presence_abs.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 f9bce5117161
children
line wrap: on
line diff
--- a/graph_stat_presence_abs.r	Tue Jul 27 16:56:39 2021 +0000
+++ b/graph_stat_presence_abs.r	Fri Aug 13 18:16:26 2021 +0000
@@ -20,6 +20,7 @@
     spe <- as.numeric(args[4])
     loc <- as.numeric(args[5])
     time <- as.numeric(args[6])
+    source(args[7])
 }
 
 if (hr == "false") {
@@ -37,7 +38,6 @@
 coltime <- colnames(data)[time]
 
 data <- data[grep("^$", data[, spe], invert = TRUE), ]
-time <- as.integer(substring(data[, time], first = 1, last = 4))
 
 #####Your analysis
 
@@ -75,17 +75,7 @@
 #### Zero problem in data ####
 
 #Put data in form
-make_table_analyse <- function(data, var, spe, var2, var3) {
-    tab <- reshape(data
-                  , v.names = var
-                  , idvar = c(var2, var3)
-                  , timevar = spe
-                  , direction = "wide")
-    tab[is.na(tab)] <- 0 ###### remplace les na par des 0 / replace NAs by 0
 
-    colnames(tab) <- sub(var, "", colnames(tab))### remplace le premier pattern "abond." par le second "" / replace the column names "abond." by ""
-    return(tab)
-}
 data_num <- make_table_analyse(data, colvar, colspe, colloc, coltime)
 nb_spe <- length(unique(data[, spe]))
 nb_col <- ncol(data_num) - nb_spe + 1