From 18c0251c620f55e93662dfc9497e4b2bf4684f6d Mon Sep 17 00:00:00 2001
From: Francesco Sabatini <francesco.sabatini@idiv.de>
Date: Mon, 17 Aug 2020 11:28:59 +0200
Subject: [PATCH] Temporary change - exclude nas

---
 01b_MesobromionCluster.R | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/01b_MesobromionCluster.R b/01b_MesobromionCluster.R
index 79bf597..223f6cd 100644
--- a/01b_MesobromionCluster.R
+++ b/01b_MesobromionCluster.R
@@ -80,11 +80,20 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY
   
   
   traits <- traits %>% 
-    column_to_rownames("species0") %>% 
     rename_all(.funs=~gsub(pattern=".mean$", replacement="", x=.))  %>% 
-    mutate_if(~is.character(.), .funs=~as.factor(.))
+    mutate_if(~is.character(.), .funs=~as.factor(.)) %>%
+    column_to_rownames("species0")
+
 #temporary    ### Use only a subset of traits
     #dplyr::select(LeafArea:Disp.unit.leng)
+  print("TEMPORARY - delete species with any NA in traits")
+  traits <- traits %>%
+     filter(complete.cases(.))
+  species <- species %>%
+     dplyr::select(rownames(traits))
+
+  print("TEMPORARY - revert back species to pa")
+  species <- (species>0)*1
   
   if(combinations=="all") {
     ## create list of indices for each combination of traits up to a max number of interactions
-- 
GitLab