From f1611e6b01e1055531659d91be506cc7c2a818ac Mon Sep 17 00:00:00 2001 From: Francesco Sabatini <francesco.sabatini@idiv.de> Date: Mon, 17 Aug 2020 17:31:34 +0200 Subject: [PATCH] Aligned --- 01b_MesobromionCluster.R | 19 +++++++++---------- cli_01b.r | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/01b_MesobromionCluster.R b/01b_MesobromionCluster.R index 223f6cd..2d822d4 100644 --- a/01b_MesobromionCluster.R +++ b/01b_MesobromionCluster.R @@ -82,18 +82,17 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY traits <- traits %>% rename_all(.funs=~gsub(pattern=".mean$", replacement="", x=.)) %>% mutate_if(~is.character(.), .funs=~as.factor(.)) %>% + filter(complete.cases(.)) %>% ## TEMPORARY ! only species without any NA 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(.)) + print("TEMPORARY - only species without any NA") species <- species %>% - dplyr::select(rownames(traits)) + dplyr::select(rownames(traits)) - print("TEMPORARY - revert back species to pa") + print("TEMPORARY - revert abundances back to pa") species <- (species>0)*1 + +#temporary ### Use only a subset of traits + #dplyr::select(LeafArea:Disp.unit.leng) if(combinations=="all") { ## create list of indices for each combination of traits up to a max number of interactions @@ -119,10 +118,10 @@ Mesobromion <- function(species.path, traits.path, output, myfunction="get.corXY corXY.output <- foreach(i=1:length(allcomb.t), .combine=rbind) %myinfix% { tt <- unlist(allcomb.t[i]) corXY.output <- rbind(corXY.output, - get.corXY.bootstrap(comm=species, trait=traits, + myfunction(comm=species, trait=traits, trait.sel=tt, bootstrap=nperm)) } - save(corXY.output, file = paste(output, "_.RData", sep="")) + save(corXY.output, file = paste(output,"_", chunk.i, "_.RData", sep="")) } diff --git a/cli_01b.r b/cli_01b.r index 65f8ff1..b795568 100644 --- a/cli_01b.r +++ b/cli_01b.r @@ -105,4 +105,4 @@ ncores <- cli$options$ncores # ------------------------------------------------------------------------------ source("01b_MesobromionCluster.R") -Mesobromion(species.path, traits.path, output, myfunction, combinations, start.round, relax.round, max.inter.t, chunk.n, chunk.i, nperm, ncores) +Mesobromion(species.path, traits.path, output, myfunction, combinations, start.round, relax.round, max.inter.t, chunkn, chunk.i, nperm, ncores) -- GitLab