diff graph_stat_presence_abs.r @ 1:3df8937fd6fd 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:46 +0000
parents 9f679060051a
children
line wrap: on
line diff
--- a/graph_stat_presence_abs.r	Tue Jul 27 16:56:15 2021 +0000
+++ b/graph_stat_presence_abs.r	Fri Aug 13 18:16:46 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