diff --git a/01b_MesobromionCluster.R b/01b_MesobromionCluster.R index 223f6cd03f863b5ebfb22df8ab9ba7ad0ce5eb9a..2d822d4b4bf841ab6b63b01b760410728e54dd47 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 65f8ff13f4a44bbc358478bfa0ceca1fea7a2763..b7955685bc858ac7d09a047c68610479812086ab 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)